aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-02-24 13:19:37 +0100
committerAleksandr Nogikh <wp32pw@gmail.com>2023-02-24 13:44:29 +0100
commitbcf47da879490ab07add3ac98042f8bde8e514d0 (patch)
treed22fc40ff1cc381915d3398046736a646dca6e82
parent3431f091b7c2afb95928a6be2ea80f19e798a1c2 (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.go6
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, &currentURLKey, 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(&currentURLKey).(string)
if ok {
return val
}