Skip to content

Commit

Permalink
fix: only append MethodOptions as allowed method if HandleOPTIONS is …
Browse files Browse the repository at this point in the history
…true (#360)
  • Loading branch information
Conni2461 authored Jan 30, 2024
1 parent ef8578d commit 4840180
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion router.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,9 @@ func (r *Router) allowed(path, reqMethod string) (allow string) {

if len(allowed) > 0 {
// Add request method to list of allowed methods
allowed = append(allowed, http.MethodOptions)
if r.HandleOPTIONS {
allowed = append(allowed, http.MethodOptions)
}

// Sort allowed methods.
// sort.Strings(allowed) unfortunately causes unnecessary allocations
Expand Down

0 comments on commit 4840180

Please sign in to comment.