fix golint issues in rest (#529)
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
var pathVars = contextKey("pathVars")
|
||||
|
||||
// Vars parses path variables and returns a map.
|
||||
func Vars(r *http.Request) map[string]string {
|
||||
vars, ok := r.Context().Value(pathVars).(map[string]string)
|
||||
if ok {
|
||||
@@ -16,6 +17,7 @@ func Vars(r *http.Request) map[string]string {
|
||||
return nil
|
||||
}
|
||||
|
||||
// WithPathVars writes params into given r and returns a new http.Request.
|
||||
func WithPathVars(r *http.Request, params map[string]string) *http.Request {
|
||||
return r.WithContext(context.WithValue(r.Context(), pathVars, params))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user