INNER CODE UNIT · TypeScript
path
cloudflare/miniflare · packages/core/src/index.ts:1091
let path = url.pathname + url.search;
// Remove leading slash so we resolve relative to upstream's path
if (path.startsWith("/")) path = path.substring(1);
const newURL = new URL(path, upstreamURL);
request = new Request(newURL, request);
// We don't set the Host header here, fetch will automatically set it
// based on the request url
}
// Each fetch gets its own context (e.g. 50 subrequests).
// Start a new pipeline, incrementing the request depth (defaulting to 1).
const requestDepth =
(parseInt(request.headers.get(_kLoopHeader)!) || 0) + 1;
// Hide the loop header from the user
request.headers.delete(_kLoopHeader);
return new RequestContext({
requestDepth,
pipelineDepth: 1,