Skip to content

Commit

Permalink
update: add next
Browse files Browse the repository at this point in the history
  • Loading branch information
predam committed Apr 21, 2024
1 parent 9f08a1b commit ab0798a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/nextjs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,15 @@ async function convertToStandardRequest(nextReq: NextApiRequest): Promise<Reques
headers.set(key, value as string);
});

// https://developer.mozilla.org/en-US/docs/Web/API/fetch#body
const includeBody = !!method && ["GET", "HEAD"].includes(method);

// Create a new Request object (hardcode the url because it doesn't really matter what it is)
const webReq = new Request("https://next.js/api/trigger", {
headers,
method,
// @ts-ignore
body: nextReq,
body: includeBody ? nextReq : undefined,
duplex: "half",
});

Expand Down

0 comments on commit ab0798a

Please sign in to comment.