diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2023-02-24 13:19:37 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2023-02-24 13:44:29 +0100 |
| commit | bcf47da879490ab07add3ac98042f8bde8e514d0 (patch) | |
| tree | d22fc40ff1cc381915d3398046736a646dca6e82 | |
| parent | 3431f091b7c2afb95928a6be2ea80f19e798a1c2 (diff) | |
dashboard: use refrence as the current URL key
It's more common to do so that to pass a string.
| -rw-r--r-- | dashboard/app/handler.go | 6 |
1 files 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 } |
