MCPcopy Create free account
hub / github.com/callstack/agent-device / resolveUpstreamBody

Function resolveUpstreamBody

src/remote/daemon-proxy.ts:331–340  ·  view source on GitHub ↗
(
  req: IncomingMessage,
  route: string,
  rpcBody: string | undefined,
  upstreamToken: string,
)

Source from the content-addressed store, hash-verified

329}
330
331function resolveUpstreamBody(
332 req: IncomingMessage,
333 route: string,
334 rpcBody: string | undefined,
335 upstreamToken: string,
336): BodyInit | undefined {
337 if (req.method === 'GET' || req.method === 'HEAD') return undefined;
338 if (route === '/rpc') return rewriteRpcToken(rpcBody ?? '', upstreamToken);
339 return req as unknown as BodyInit;
340}
341
342function isAuthorized(req: IncomingMessage, expectedToken: string, rpcBody: string | undefined) {
343 const requestToken = resolveRequestToken(req, rpcBody);

Callers 1

forwardProxyRequestFunction · 0.85

Calls 1

rewriteRpcTokenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…