Contract test awaits the now-async proxy

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YafYxayh7Gqe5MWNNQMev2
This commit is contained in:
Anthony Ettinger 2026-09-05 21:45:34 +00:00
parent c3c5406c70
commit b09121ac52

View file

@ -60,21 +60,21 @@ function jsonResponse(body: unknown, status = 200): Response {
} }
describe("www canonical redirect (proxy.ts)", () => { describe("www canonical redirect (proxy.ts)", () => {
it("301s www to the apex host over https, preserving path + query", () => { it("301s www to the apex host over https, preserving path + query", async () => {
const request = new NextRequest("https://www.logicsrc.com/openspec?ref=email", { const request = new NextRequest("https://www.logicsrc.com/openspec?ref=email", {
headers: { host: "www.logicsrc.com" } headers: { host: "www.logicsrc.com" }
}); });
const response = proxy(request); const response = await proxy(request);
expect(response.status).toBe(301); expect(response.status).toBe(301);
expect(response.headers.get("location")).toBe("https://logicsrc.com/openspec?ref=email"); expect(response.headers.get("location")).toBe("https://logicsrc.com/openspec?ref=email");
}); });
it("passes through apex requests untouched", () => { it("passes through apex requests untouched", async () => {
const request = new NextRequest("https://logicsrc.com/hire-us", { const request = new NextRequest("https://logicsrc.com/hire-us", {
headers: { host: "logicsrc.com" } headers: { host: "logicsrc.com" }
}); });
const response = proxy(request); const response = await proxy(request);
// NextResponse.next() yields a non-redirect response. // NextResponse.next() yields a non-redirect response.
expect(response.status).toBe(200); expect(response.status).toBe(200);