Skip to content

Commit

Permalink
chore(test): test JSON proxy transparency
Browse files Browse the repository at this point in the history
  • Loading branch information
Aareksio committed Aug 19, 2023
1 parent 8af0474 commit 3e062d6
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 3e062d6

Please sign in to comment.