minor: see prev commit for a new feature

Former-commit-id: ab76d81d325778052e013b028f1d44d29adea618
This commit is contained in:
Gerasimos (Makis) Maropoulos 2019-08-06 15:43:55 +03:00
parent 95ce71be9f
commit 3342ac5439

View File

@ -198,7 +198,7 @@ func New(opt ...Option) router.WrapperFunc {
return func(w http.ResponseWriter, r *http.Request, proceed http.HandlerFunc) { return func(w http.ResponseWriter, r *http.Request, proceed http.HandlerFunc) {
originalMethod := strings.ToUpper(r.Method) originalMethod := strings.ToUpper(r.Method)
if opts.canOverride(originalMethod) { if opts.canOverride(originalMethod) {
newMethod := opts.get(w, r) newMethod := strings.ToUpper(opts.get(w, r))
if newMethod != "" { if newMethod != "" {
if opts.saveOriginalMethodContextKey != nil { if opts.saveOriginalMethodContextKey != nil {
r = r.WithContext(stdContext.WithValue(r.Context(), opts.saveOriginalMethodContextKey, originalMethod)) r = r.WithContext(stdContext.WithValue(r.Context(), opts.saveOriginalMethodContextKey, originalMethod))