rename countkey to title
1 file changed, 8 insertions(+), 8 deletions(-)
changed files
M domain/analytics/middleware.go → domain/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) } }) }