Skip to content

Commit

Permalink
Update request context funcs to take concrete types
Browse files Browse the repository at this point in the history
  • Loading branch information
fharding1 committed Oct 24, 2019
1 parent 51b0355 commit faac3f3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mux.go
Expand Up @@ -445,13 +445,13 @@ func CurrentRoute(r *http.Request) *Route {
return nil
}

func requestWithVars(r *http.Request, val interface{}) *http.Request {
ctx := context.WithValue(r.Context(), varsKey, val)
func requestWithVars(r *http.Request, vars map[string]string) *http.Request {
ctx := context.WithValue(r.Context(), varsKey, vars)
return r.WithContext(ctx)
}

func requestWithRoute(r *http.Request, val interface{}) *http.Request {
ctx := context.WithValue(r.Context(), routeKey, val)
func requestWithRoute(r *http.Request, route *Route) *http.Request {
ctx := context.WithValue(r.Context(), routeKey, route)
return r.WithContext(ctx)
}

Expand Down

0 comments on commit faac3f3

Please sign in to comment.