( req: http.IncomingMessage, res: http.ServerResponse, authorize: AuxiliaryHttpAuthorizer, )
| 181 | } |
| 182 | |
| 183 | async function handleUploadFinalize( |
| 184 | req: http.IncomingMessage, |
| 185 | res: http.ServerResponse, |
| 186 | authorize: AuxiliaryHttpAuthorizer, |
| 187 | ): Promise<void> { |
| 188 | try { |
| 189 | const auth = await authorize({ |
| 190 | req, |
| 191 | res, |
| 192 | daemonRequest: { |
| 193 | command: 'upload', |
| 194 | positionals: ['finalize'], |
| 195 | }, |
| 196 | }); |
| 197 | if (!auth) return; |
| 198 | |
| 199 | const body = await readRestJsonBody(req, 64 * 1024); |
| 200 | const finalize = readUploadFinalizeBody(body); |
| 201 | sendUploadedArtifactResponse( |
| 202 | res, |
| 203 | await finalizeResumableUpload(finalize.uploadId, auth.tenantId), |
| 204 | auth.tenantId, |
| 205 | ); |
| 206 | } catch (error) { |
| 207 | sendRestJsonError(res, normalizeError(error)); |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | function sendJson(res: http.ServerResponse, body: Record<string, unknown>): void { |
| 212 | res.statusCode = 200; |
no test coverage detected
searching dependent graphs…