You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the WithContext is used the mux.Vars are unavailable in the route handler.
github.com/gorilla/mux v1.8.1
Expected Behavior
When the WithContext is used the mux.Vars are available in the route handler.
github.com/gorilla/mux v1.8.1
Steps To Reproduce
// Store the username in the context
ctx := context.WithValue(context.Background(), "username", claims.Username)
requestWithContext := request.WithContext(ctx)
// Update handles PUT requests to update an existing Item
func (this *ItemController) Update(response http.ResponseWriter, request *http.Request) {
vars := mux.Vars(request)
uuid := vars["uuid"]
Anything else?
No response
The text was updated successfully, but these errors were encountered:
One should use context coming w/ the request as base for WithContext. context.Background() returns an empty context, so all information already in the request context is lost.
Is there an existing issue for this?
Current Behavior
When the WithContext is used the mux.Vars are unavailable in the route handler.
github.com/gorilla/mux v1.8.1
Expected Behavior
When the WithContext is used the mux.Vars are available in the route handler.
github.com/gorilla/mux v1.8.1
Steps To Reproduce
// Store the username in the context
ctx := context.WithValue(context.Background(), "username", claims.Username)
requestWithContext := request.WithContext(ctx)
// Update handles PUT requests to update an existing Item
func (this *ItemController) Update(response http.ResponseWriter, request *http.Request) {
Anything else?
No response
The text was updated successfully, but these errors were encountered: