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.


This commit was moved from ipfs/kubo@7340543
  • Loading branch information
hsanjuan committed Apr 5, 2020
1 parent 7ce444a commit ecb855b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gateway/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 ecb855b

Please sign in to comment.