From 7407447bbf5d11e70063291868e900743354e3fb Mon Sep 17 00:00:00 2001 From: rcourtman Date: Tue, 2 Dec 2025 00:01:17 +0000 Subject: [PATCH] test: Add edge case for handleServerInfo method not allowed Tests that POST requests to /api/server/info return 405. --- internal/api/router_integration_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/internal/api/router_integration_test.go b/internal/api/router_integration_test.go index 624f178..9921f35 100644 --- a/internal/api/router_integration_test.go +++ b/internal/api/router_integration_test.go @@ -331,6 +331,25 @@ func TestServerInfoEndpointReportsDevelopment(t *testing.T) { } } +func TestServerInfoEndpointMethodNotAllowed(t *testing.T) { + srv := newIntegrationServer(t) + + req, err := http.NewRequest(http.MethodPost, srv.server.URL+"/api/server/info", nil) + if err != nil { + t.Fatalf("create request failed: %v", err) + } + + res, err := http.DefaultClient.Do(req) + if err != nil { + t.Fatalf("server info POST request failed: %v", err) + } + defer res.Body.Close() + + if res.StatusCode != http.StatusMethodNotAllowed { + t.Fatalf("unexpected status: got %d want %d", res.StatusCode, http.StatusMethodNotAllowed) + } +} + func TestConfigNodesUsesMockTopology(t *testing.T) { srv := newIntegrationServer(t)