MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / multipartPayload

Function multipartPayload

apps/cli/src/http/routes/web/import-source.test.ts:37–53  ·  view source on GitHub ↗
(fileName: string, file: Buffer)

Source from the content-addressed store, hash-verified

35}
36
37function multipartPayload(fileName: string, file: Buffer): { payload: Buffer; contentType: string } {
38 const boundary = '----chatlab-import-source-test'
39 const header = Buffer.from(
40 [
41 `--${boundary}`,
42 `Content-Disposition: form-data; name="file"; filename="${fileName}"`,
43 'Content-Type: application/zip',
44 '',
45 '',
46 ].join('\r\n')
47 )
48 const footer = Buffer.from(`\r\n--${boundary}--\r\n`)
49 return {
50 payload: Buffer.concat([header, file, footer]),
51 contentType: `multipart/form-data; boundary=${boundary}`,
52 }
53}
54
55describe('CLI Web archive import source routes', () => {
56 it('uploads once, reuses the source for imports, and releases idempotently', async () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected