Skip to content

Commit

Permalink
add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Mar 28, 2023
1 parent ae1f91d commit f37b04f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/body.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,26 @@ describe("", () => {
expect(result.text).toBe("200");
});

it("handle raw body with buffer type (unenv)", async () => {
app.use(
"/",
eventHandler(async (event) => {
// Emulate unenv
// @ts-ignore
event.node.req.body = Buffer.from("test");

const body = await readBody(event);
expect(body).toMatchObject("test");

return "200";
})
);

const result = await request.post("/api/test").send();

expect(result.text).toBe("200");
});

it("parses multipart form data", async () => {
app.use(
"/",
Expand Down

0 comments on commit f37b04f

Please sign in to comment.