MCPcopy
hub / github.com/triggerdotdev/trigger.dev / convertToStandardRequest

Function convertToStandardRequest

packages/nextjs/src/index.ts:64–83  ·  view source on GitHub ↗
(nextReq: NextApiRequest)

Source from the content-addressed store, hash-verified

62}
63
64async function convertToStandardRequest(nextReq: NextApiRequest): Promise<Request> {
65 const { headers: nextHeaders, method } = nextReq;
66
67 const headers = new Headers();
68
69 Object.entries(nextHeaders).forEach(([key, value]) => {
70 headers.set(key, value as string);
71 });
72
73 // Create a new Request object (hardcode the url because it doesn't really matter what it is)
74 const webReq = new Request("https://next.js/api/trigger", {
75 headers,
76 method,
77 // @ts-ignore
78 body: nextReq,
79 duplex: "half",
80 });
81
82 return webReq;
83}

Callers 1

handlerFunction · 0.70

Calls 1

setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…