From bcf47da879490ab07add3ac98042f8bde8e514d0 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 24 Feb 2023 13:19:37 +0100 Subject: dashboard: use refrence as the current URL key It's more common to do so that to pass a string. --- dashboard/app/handler.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dashboard/app/handler.go b/dashboard/app/handler.go index 135378b7b..0aafd73c8 100644 --- a/dashboard/app/handler.go +++ b/dashboard/app/handler.go @@ -32,7 +32,7 @@ func handlerWrapper(fn contextHandler) http.Handler { func handleContext(fn contextHandler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { c := appengine.NewContext(r) - c = context.WithValue(c, currentURLKey, r.URL.RequestURI()) + c = context.WithValue(c, ¤tURLKey, r.URL.RequestURI()) if err := fn(c, w, r); err != nil { hdr := commonHeaderRaw(c, r) data := &struct { @@ -74,10 +74,10 @@ func handleContext(fn contextHandler) http.Handler { }) } -const currentURLKey = "current_url" +var currentURLKey = "the URL of the HTTP request in context" func getCurrentURL(c context.Context) string { - val, ok := c.Value(currentURLKey).(string) + val, ok := c.Value(¤tURLKey).(string) if ok { return val } -- cgit mrf-deployment