diff --git a/http/errors_test.go b/http/errors_test.go index 48b8359319ac8c95fc693b3e9bb397bc2c1b1e1d..bb5b68491cb9e9a53a4c33d13a6cec53ad19aa34 100644 --- a/http/errors_test.go +++ b/http/errors_test.go @@ -165,7 +165,7 @@ func TestUnhandledMethod(t *testing.T) { AllowGet: false, Code: http.StatusMethodNotAllowed, ResHeaders: map[string]string{ - "Allow": "POST, HEAD, OPTIONS", + "Allow": "POST, OPTIONS", }, } tc.test(t) diff --git a/http/handler.go b/http/handler.go index a1756f6d51a1b2b0e05c40cb8ae2e12485336808..7272b614077cfcf7d900bdfc8a82b1615ad0eb08 100644 --- a/http/handler.go +++ b/http/handler.go @@ -192,10 +192,10 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } func setAllowedHeaders(w http.ResponseWriter, allowGet bool) { - w.Header().Add("Allow", http.MethodHead) w.Header().Add("Allow", http.MethodOptions) w.Header().Add("Allow", http.MethodPost) if allowGet { + w.Header().Add("Allow", http.MethodHead) w.Header().Add("Allow", http.MethodGet) } }