diff --git a/admin_info.go b/admin_info.go index f97dc753d..0231475e5 100644 --- a/admin_info.go +++ b/admin_info.go @@ -57,6 +57,7 @@ type infoResponse struct { func (AdminInfo) handleInfo(w http.ResponseWriter, r *http.Request) error { if r.Method != http.MethodGet { + w.Header().Set("Allow", http.MethodGet) return APIError{ HTTPStatus: http.StatusMethodNotAllowed, Message: "method not allowed", diff --git a/admin_info_test.go b/admin_info_test.go index d4a964e79..96dc18bd4 100644 --- a/admin_info_test.go +++ b/admin_info_test.go @@ -90,5 +90,8 @@ func TestAdminInfoHandler(t *testing.T) { if apiErr.HTTPStatus != http.StatusMethodNotAllowed { t.Errorf("expected status %d, got %d", http.StatusMethodNotAllowed, apiErr.HTTPStatus) } + if allow := rec.Header().Get("Allow"); allow != http.MethodGet { + t.Errorf("expected Allow header %q, got %q", http.MethodGet, allow) + } }) }