Skip to content

Commit

Permalink
minor, relative to: kataras#1325
Browse files Browse the repository at this point in the history
Former-commit-id: 9febac1ba701b29e59d7660540f03217f12cf9e0
  • Loading branch information
kataras committed Aug 6, 2019
1 parent 3342ac5 commit 8ac32ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions middleware/methodoverride/methodoverride.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (o *options) canOverride(method string) bool {
func (o *options) get(w http.ResponseWriter, r *http.Request) string {
for _, getter := range o.getters {
if v := getter(w, r); v != "" {
return v
return strings.ToUpper(v)
}
}

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

0 comments on commit 8ac32ed

Please sign in to comment.