( proxyPort: number, capture: ResumableUploadProxyCapture, )
| 419 | } |
| 420 | |
| 421 | async function assertFinalizeUsesDaemonToken( |
| 422 | proxyPort: number, |
| 423 | capture: ResumableUploadProxyCapture, |
| 424 | ): Promise<void> { |
| 425 | const finalize = await fetch(`http://127.0.0.1:${proxyPort}/agent-device/upload/finalize`, { |
| 426 | method: 'POST', |
| 427 | headers: { |
| 428 | authorization: 'Bearer proxy-secret', |
| 429 | 'content-type': 'application/json', |
| 430 | }, |
| 431 | body: JSON.stringify({ uploadId: 'upload-1' }), |
| 432 | }); |
| 433 | assert.equal(finalize.status, 200); |
| 434 | assert.deepEqual(await finalize.json(), { ok: true, uploadId: 'tracked-upload-1' }); |
| 435 | assert.equal(capture.finalizeAuth, 'Bearer daemon-secret'); |
| 436 | } |
| 437 | |
| 438 | function createResumableUploadProxyUpstream(capture: ResumableUploadProxyCapture): http.Server { |
| 439 | return http.createServer((req, res) => { |
no outgoing calls
no test coverage detected
searching dependent graphs…