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

Function sendProxyResponse

src/remote/daemon-proxy.ts:126–144  ·  view source on GitHub ↗
(params: {
  req: IncomingMessage;
  res: ServerResponse;
  route: string;
  response: Response;
  clientToken: string;
})

Source from the content-addressed store, hash-verified

124}
125
126async function sendProxyResponse(params: {
127 req: IncomingMessage;
128 res: ServerResponse;
129 route: string;
130 response: Response;
131 clientToken: string;
132}): Promise<void> {
133 const { req, res, route, response, clientToken } = params;
134 res.statusCode = response.status;
135 copyProxyResponseHeaders(response, res);
136 ensureProxyRequestId(req, res);
137
138 if (isUploadPreflightRoute(route)) {
139 await sendRewrittenUploadPreflightResponse({ req, res, response, clientToken });
140 return;
141 }
142
143 await pipeProxyResponseBody(response, res);
144}
145
146function copyProxyResponseHeaders(response: Response, res: ServerResponse): void {
147 for (const name of FORWARDED_RESPONSE_HEADERS) {

Callers 1

forwardProxyRequestFunction · 0.85

Calls 5

copyProxyResponseHeadersFunction · 0.85
ensureProxyRequestIdFunction · 0.85
isUploadPreflightRouteFunction · 0.85
pipeProxyResponseBodyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…