MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / convertToStandardRequest

Function convertToStandardRequest

packages/sveltekit/src/index.ts:20–42  ·  view source on GitHub ↗
(req: Request)

Source from the content-addressed store, hash-verified

18}
19
20async function convertToStandardRequest(req: Request): Promise<Request> {
21 // Prepare the request to be a fetch-compatible Request object:
22 const requestHeaders = req.headers;
23 const requestMethod = req.method;
24 const responseHeaders = Object.create(null);
25
26 for (const [headerName, headerValue] of requestHeaders.entries()) {
27 responseHeaders[headerName] = headerValue;
28 }
29
30 // Create a new Request object to be passed to the TriggerClient
31 // where we pass the clone the incoming request metadata such as
32 // headers, method, body.
33 const request = new Request("https://svelte/api/trigger", {
34 headers: responseHeaders,
35 method: requestMethod,
36 // @ts-ignore
37 body: req.body ? req.body : req,
38 duplex: "half",
39 });
40
41 return request;
42}

Callers 1

POSTFunction · 0.70

Calls 1

createMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…