Skip to content

Commit

Permalink
test(proxy): add additional test to make sure json response is sent a…
Browse files Browse the repository at this point in the history
…s is (#512)
  • Loading branch information
Aareksio authored Aug 20, 2023
1 parent 8af0474 commit a3ad8c2
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/proxy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,33 @@ describe("", () => {
'"This is a streamed request."',
);
});

it("can proxy json transparently", async () => {
const message = '{"hello":"world"}';

app.use(
"/debug",
eventHandler((event) => {
setHeader(event, "content-type", "application/json");
return message;
}),
);

app.use(
"/",
eventHandler((event) => {
return proxyRequest(event, url + "/debug", { fetch });
}),
);

const res = await fetch(url + "/", {
method: "GET",
});

const resText = await res.text();

expect(resText).toEqual(message);
});
});

describe("multipleCookies", () => {
Expand Down

0 comments on commit a3ad8c2

Please sign in to comment.