TestSpecServedOverHTTP confirms the spec is reachable at the versioned path so SDK/MCP codegen and the docs renderer can fetch it from a running instance.
(t *testing.T)
| 130 | // path so SDK/MCP codegen and the docs renderer can fetch it from a running |
| 131 | // instance. |
| 132 | func TestSpecServedOverHTTP(t *testing.T) { |
| 133 | srv := httptest.NewServer(New(Deps{})) |
| 134 | defer srv.Close() |
| 135 | |
| 136 | resp, err := http.Get(srv.URL + "/v1/openapi.yaml") |
| 137 | if err != nil { |
| 138 | t.Fatal(err) |
| 139 | } |
| 140 | defer resp.Body.Close() |
| 141 | if resp.StatusCode != 200 { |
| 142 | t.Fatalf("status: %d", resp.StatusCode) |
| 143 | } |
| 144 | b, _ := io.ReadAll(resp.Body) |
| 145 | if !strings.Contains(string(b), "openapi: 3.1.0") { |
| 146 | t.Fatalf("served spec is not OpenAPI 3.1: %.80s", b) |
| 147 | } |
| 148 | } |