From 5cc146a7b146782d07380158a7a7db10a2d424ed Mon Sep 17 00:00:00 2001 From: Zack Wagner Date: Wed, 7 Oct 2026 09:21:08 -0400 Subject: [PATCH] admin: set Allow header on /info 405 response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per RFC 9110 ยง15.5.6, a 405 response must include an Allow header listing the supported methods. Co-Authored-By: Claude Opus 5.5 --- admin_info.go | 1 + admin_info_test.go | 3 +++ 2 files changed, 4 insertions(+) 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) + } }) }