@cryptotaxi247 / kubo / commits / 734054361

corehttp: Gateway handler: add Allow headers when returning MethodNotAllowed

Spec says that response with 405 must set Allow headers.

Hector Sanjuan committed Apr 4, 2020 at 02:06 UTC 73405436159b5953f6ed107f45d7aa3badf4bf44
1 file changed +3
core/corehttp/gateway_handler.go
+3
@@ -127,6 +127,9 @@ func (i *gatewayHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
127 if !i.config.Writable {
128 status = http.StatusMethodNotAllowed
129 errmsg = errmsg + "read only access"
130 + w.Header().Add("Allow", http.MethodGet)
131 + w.Header().Add("Allow", http.MethodHead)
132 + w.Header().Add("Allow", http.MethodOptions)
133 } else {
134 status = http.StatusBadRequest
135 errmsg = errmsg + "bad request for " + r.URL.Path