Skip to content

Commit b960a74

Browse files
committed
test(proxy): avoid consuming body in interceptor
1 parent 8783ab6 commit b960a74

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/proxy.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,23 +399,23 @@ describe("", () => {
399399
});
400400

401401
it("allows to get the actual response", async () => {
402-
let proxyResponse;
402+
let headers;
403403

404404
app.use(
405405
"/",
406406
eventHandler((event) => {
407407
return proxyRequest(event, url + "/debug", {
408408
fetch,
409-
async onResponse(_event, response) {
410-
proxyResponse = await response.json();
409+
onResponse(_event, response) {
410+
headers = Object.fromEntries(response.headers.entries());
411411
},
412412
});
413413
})
414414
);
415415

416416
await request.get("/");
417417

418-
expect(proxyResponse).toEqual({ foo: "bar" });
418+
expect(headers["content-type"]).toEqual("application/json");
419419
});
420420
});
421421
});

0 commit comments

Comments
 (0)