MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / rewriteLocationHeader

Function rewriteLocationHeader

packages/ci-proxy-worker/src/index.ts:249–264  ·  view source on GitHub ↗
(
  headers: Headers,
  upstream: URL,
  proxyOrigin: string,
)

Source from the content-addressed store, hash-verified

247}
248
249function rewriteLocationHeader(
250 headers: Headers,
251 upstream: URL,
252 proxyOrigin: string,
253): void {
254 const location = headers.get("Location");
255 if (!location) return;
256
257 const rewritten = new URL(location, upstream);
258 if (rewritten.origin === upstream.origin) {
259 headers.set(
260 "Location",
261 `${proxyOrigin}${rewritten.pathname}${rewritten.search}${rewritten.hash}`,
262 );
263 }
264}
265
266function parseEncodedSession(value: string): EncodedSession {
267 const decoded = base64UrlDecode(value);

Callers 1

proxyToSimDeckFunction · 0.85

Calls 2

setMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected