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

Function assertFinalizeUsesDaemonToken

src/__tests__/daemon-proxy.test.ts:421–436  ·  view source on GitHub ↗
(
  proxyPort: number,
  capture: ResumableUploadProxyCapture,
)

Source from the content-addressed store, hash-verified

419}
420
421async 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
438function createResumableUploadProxyUpstream(capture: ResumableUploadProxyCapture): http.Server {
439 return http.createServer((req, res) => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…