all repos — homestead @ bab78381a9c54b809dc76144aa9f773d387bb621

Code for my website

rename countkey to title

Alan Pearce
commit

bab78381a9c54b809dc76144aa9f773d387bb621

parent

7cc6162387db91d5be21121d8c6d232f06b513ad

1 file changed, 8 insertions(+), 8 deletions(-)

changed files
M domain/analytics/middleware.godomain/analytics/middleware.go
@@ -9,14 +9,14 @@ )
type contextKey struct{} -var countKeyContextKey contextKey +var titleContextKey contextKey -func WithCountKey(r *http.Request, key string) *http.Request { - return r.WithContext(context.WithValue(r.Context(), countKeyContextKey, key)) +func WithTitle(r *http.Request, key string) *http.Request { + return r.WithContext(context.WithValue(r.Context(), titleContextKey, key)) } -func GetCountKey(r *http.Request) (string, bool) { - key, ok := r.Context().Value(countKeyContextKey).(string) +func GetTitle(r *http.Request) (string, bool) { + key, ok := r.Context().Value(titleContextKey).(string) return key, ok }
@@ -28,15 +28,15 @@ rw := sharedhttp.NewStatusCapturingResponseWriter(w)
next.ServeHTTP(rw, r) - countKey, ok := GetCountKey(r) + title, ok := GetTitle(r) if !ok { if rw.Status >= 201 { - countKey = http.StatusText(rw.Status) + title = http.StatusText(rw.Status) } } if rw.Status <= 299 { - counter.Count(r, countKey) + counter.Count(r, title) } }) }