(t *testing.T)
| 662 | } |
| 663 | |
| 664 | func 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 | } |
nothing calls this directly
no test coverage detected