MCPcopy Index your code
hub / github.com/callstack/agent-device / handleUpload

Function handleUpload

src/daemon/upload-http.ts:94–114  ·  view source on GitHub ↗
(
  req: http.IncomingMessage,
  res: http.ServerResponse,
  authorize: AuxiliaryHttpAuthorizer,
)

Source from the content-addressed store, hash-verified

92}
93
94async function handleUpload(
95 req: http.IncomingMessage,
96 res: http.ServerResponse,
97 authorize: AuxiliaryHttpAuthorizer,
98): Promise<void> {
99 try {
100 const auth = await authorize({
101 req,
102 res,
103 daemonRequest: {
104 command: 'upload',
105 positionals: [],
106 },
107 });
108 if (!auth) return;
109
110 sendUploadedArtifactResponse(res, await receiveUpload(req), auth.tenantId);
111 } catch (error) {
112 sendRestJsonError(res, normalizeError(error));
113 }
114}
115
116async function handleUploadPreflight(
117 req: http.IncomingMessage,

Callers 1

handleUploadHttpRouteFunction · 0.70

Calls 4

receiveUploadFunction · 0.90
sendRestJsonErrorFunction · 0.90
normalizeErrorFunction · 0.90

Tested by

no test coverage detected