MCPcopy
hub / github.com/axios/axios / makeUploadStream

Function makeUploadStream

tests/unit/adapters/fetch.test.js:1281–1296  ·  view source on GitHub ↗
(totalBytes, chunkSize = 512)

Source from the content-addressed store, hash-verified

1279
1280 describe('size limits', () => {
1281 const makeUploadStream = (totalBytes, chunkSize = 512) => {
1282 let remaining = totalBytes;
1283
1284 return new ReadableStream({
1285 pull(controller) {
1286 if (remaining <= 0) {
1287 controller.close();
1288 return;
1289 }
1290
1291 const size = Math.min(chunkSize, remaining);
1292 remaining -= size;
1293 controller.enqueue(new Uint8Array(size));
1294 },
1295 });
1296 };
1297
1298 it('should reject an outbound body that exceeds maxBodyLength with ERR_BAD_REQUEST', async () => {
1299 const server = await startHTTPServer(

Callers 1

fetch.test.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected