server: send 405 instead of 404 for unallowed methods (#10275)

Fixes: #5483
This commit is contained in:
Devon Rifkin
2025-05-06 14:45:37 -07:00
committed by GitHub
parent 92ce438de0
commit 4090aca97b
2 changed files with 11 additions and 0 deletions

View File

@@ -485,6 +485,16 @@ func TestRoutes(t *testing.T) {
}
},
},
{
Name: "Method Not Allowed",
Method: http.MethodGet,
Path: "/api/show",
Expected: func(t *testing.T, resp *http.Response) {
if resp.StatusCode != 405 {
t.Errorf("expected status code 405, got %d", resp.StatusCode)
}
},
},
}
modelsDir := t.TempDir()