@@ -4367,7 +4367,7 @@ var require_util2 = __commonJS({
4367
4367
});
4368
4368
}
4369
4369
__name(iteratorMixin, "iteratorMixin");
4370
- async function fullyReadBody(body, processBody, processBodyError, shouldClone ) {
4370
+ async function fullyReadBody(body, processBody, processBodyError) {
4371
4371
const successSteps = processBody;
4372
4372
const errorSteps = processBodyError;
4373
4373
let reader;
@@ -4378,7 +4378,7 @@ var require_util2 = __commonJS({
4378
4378
return;
4379
4379
}
4380
4380
try {
4381
- successSteps(await readAllBytes(reader, shouldClone ));
4381
+ successSteps(await readAllBytes(reader));
4382
4382
} catch (e) {
4383
4383
errorSteps(e);
4384
4384
}
@@ -4405,19 +4405,12 @@ var require_util2 = __commonJS({
4405
4405
return input;
4406
4406
}
4407
4407
__name(isomorphicEncode, "isomorphicEncode");
4408
- async function readAllBytes(reader, shouldClone ) {
4408
+ async function readAllBytes(reader) {
4409
4409
const bytes = [];
4410
4410
let byteLength = 0;
4411
4411
while (true) {
4412
4412
const { done, value: chunk } = await reader.read();
4413
4413
if (done) {
4414
- if (bytes.length === 1) {
4415
- const { buffer, byteOffset, byteLength: byteLength2 } = bytes[0];
4416
- if (shouldClone === false) {
4417
- return Buffer.from(buffer, byteOffset, byteLength2);
4418
- }
4419
- return Buffer.from(buffer.slice(byteOffset, byteOffset + byteLength2), 0, byteLength2);
4420
- }
4421
4414
return Buffer.concat(bytes, byteLength);
4422
4415
}
4423
4416
if (!isUint8Array(chunk)) {
@@ -5393,18 +5386,18 @@ Content-Type: ${value.type || "application/octet-stream"}\r
5393
5386
mimeType = serializeAMimeType(mimeType);
5394
5387
}
5395
5388
return new Blob2([bytes], { type: mimeType });
5396
- }, instance, false );
5389
+ }, instance);
5397
5390
},
5398
5391
arrayBuffer() {
5399
5392
return consumeBody(this, (bytes) => {
5400
- return bytes.buffer;
5401
- }, instance, true );
5393
+ return new Uint8Array( bytes) .buffer;
5394
+ }, instance);
5402
5395
},
5403
5396
text() {
5404
- return consumeBody(this, utf8DecodeBytes, instance, false );
5397
+ return consumeBody(this, utf8DecodeBytes, instance);
5405
5398
},
5406
5399
json() {
5407
- return consumeBody(this, parseJSONFromBytes, instance, false );
5400
+ return consumeBody(this, parseJSONFromBytes, instance);
5408
5401
},
5409
5402
formData() {
5410
5403
return consumeBody(this, (value) => {
@@ -5433,12 +5426,12 @@ Content-Type: ${value.type || "application/octet-stream"}\r
5433
5426
throw new TypeError(
5434
5427
'Content-Type was not one of "multipart/form-data" or "application/x-www-form-urlencoded".'
5435
5428
);
5436
- }, instance, false );
5429
+ }, instance);
5437
5430
},
5438
5431
bytes() {
5439
5432
return consumeBody(this, (bytes) => {
5440
- return new Uint8Array(bytes.buffer, 0, bytes.byteLength );
5441
- }, instance, true );
5433
+ return new Uint8Array(bytes);
5434
+ }, instance);
5442
5435
}
5443
5436
};
5444
5437
return methods;
@@ -5448,7 +5441,7 @@ Content-Type: ${value.type || "application/octet-stream"}\r
5448
5441
Object.assign(prototype.prototype, bodyMixinMethods(prototype));
5449
5442
}
5450
5443
__name(mixinBody, "mixinBody");
5451
- async function consumeBody(object, convertBytesToJSValue, instance, shouldClone ) {
5444
+ async function consumeBody(object, convertBytesToJSValue, instance) {
5452
5445
webidl.brandCheck(object, instance);
5453
5446
if (bodyUnusable(object[kState].body)) {
5454
5447
throw new TypeError("Body is unusable: Body has already been read");
@@ -5467,7 +5460,7 @@ Content-Type: ${value.type || "application/octet-stream"}\r
5467
5460
successSteps(Buffer.allocUnsafe(0));
5468
5461
return promise.promise;
5469
5462
}
5470
- await fullyReadBody(object[kState].body, successSteps, errorSteps, shouldClone );
5463
+ await fullyReadBody(object[kState].body, successSteps, errorSteps);
5471
5464
return promise.promise;
5472
5465
}
5473
5466
__name(consumeBody, "consumeBody");
0 commit comments