Use own type as context key

This commit is contained in:
Ingo Oppermann
2023-03-08 14:24:53 +01:00
parent c60327c61d
commit 41eab6f40a
3 changed files with 6 additions and 4 deletions

View File

@@ -47,7 +47,7 @@ func (g *GraphHandler) Query(c echo.Context) error {
user, _ := c.Get("user").(string)
r := c.Request()
ctx := context.WithValue(r.Context(), "user", user)
ctx := context.WithValue(r.Context(), resolver.GraphKey("user"), user)
g.queryHandler.ServeHTTP(c.Response(), r.WithContext(ctx))