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

Function resolveUploadHttpRoute

src/daemon/upload-http.ts:81–92  ·  view source on GitHub ↗
(req: http.IncomingMessage)

Source from the content-addressed store, hash-verified

79}
80
81function resolveUploadHttpRoute(req: http.IncomingMessage): UploadHttpRoute | null {
82 if (req.method === 'POST' && req.url === '/upload/preflight') return { kind: 'preflight' };
83 if (req.method === 'PUT' && req.url?.startsWith(DIRECT_UPLOAD_PATH_PREFIX)) {
84 return {
85 kind: 'direct',
86 uploadId: req.url.slice(DIRECT_UPLOAD_PATH_PREFIX.length).replace(/\?.*$/, ''),
87 };
88 }
89 if (req.method === 'POST' && req.url === '/upload/finalize') return { kind: 'finalize' };
90 if (req.method === 'POST' && req.url === '/upload') return { kind: 'upload' };
91 return null;
92}
93
94async function handleUpload(
95 req: http.IncomingMessage,

Callers 1

tryHandleUploadHttpRouteFunction · 0.85

Calls 1

startsWithMethod · 0.80

Tested by

no test coverage detected