Skip to content

Commit

Permalink
corehttp: Gateway handler: add Allow headers when returning MethodNot…
Browse files Browse the repository at this point in the history
…Allowed

Spec says that response with 405 must set Allow headers.
  • Loading branch information
hsanjuan committed Apr 5, 2020
1 parent 1b49047 commit 7340543
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/corehttp/gateway_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ func (i *gatewayHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if !i.config.Writable {
status = http.StatusMethodNotAllowed
errmsg = errmsg + "read only access"
w.Header().Add("Allow", http.MethodGet)
w.Header().Add("Allow", http.MethodHead)
w.Header().Add("Allow", http.MethodOptions)
} else {
status = http.StatusBadRequest
errmsg = errmsg + "bad request for " + r.URL.Path
Expand Down

0 comments on commit 7340543

Please sign in to comment.