MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestLegacyFallback

Function TestLegacyFallback

internal/httpapi/operations_test.go:664–683  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

662}
663
664func TestLegacyFallback(t *testing.T) {
665 srv := testServer(t)
666 // A route the v1 layer does not own must fall through to the legacy
667 // handler unchanged (strangler) — and still carry the new request id.
668 resp, err := http.Get(srv.URL + "/api/v1/agents")
669 if err != nil {
670 t.Fatal(err)
671 }
672 defer resp.Body.Close()
673 if resp.StatusCode != http.StatusTeapot {
674 t.Fatalf("expected legacy 418, got %d", resp.StatusCode)
675 }
676 b, _ := io.ReadAll(resp.Body)
677 if string(b) != "legacy:/api/v1/agents" {
678 t.Fatalf("unexpected legacy body: %s", b)
679 }
680 if resp.Header.Get("X-Request-Id") == "" {
681 t.Error("legacy fallback should still carry X-Request-Id")
682 }
683}

Callers

nothing calls this directly

Calls 4

testServerFunction · 0.85
GetMethod · 0.65
CloseMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected