@@ -4367,7 +4367,7 @@ var require_util2 = __commonJS({
43674367 });
43684368 }
43694369 __name(iteratorMixin, "iteratorMixin");
4370- async function fullyReadBody(body, processBody, processBodyError, shouldClone ) {
4370+ async function fullyReadBody(body, processBody, processBodyError) {
43714371 const successSteps = processBody;
43724372 const errorSteps = processBodyError;
43734373 let reader;
@@ -4378,7 +4378,7 @@ var require_util2 = __commonJS({
43784378 return;
43794379 }
43804380 try {
4381- successSteps(await readAllBytes(reader, shouldClone ));
4381+ successSteps(await readAllBytes(reader));
43824382 } catch (e) {
43834383 errorSteps(e);
43844384 }
@@ -4405,19 +4405,12 @@ var require_util2 = __commonJS({
44054405 return input;
44064406 }
44074407 __name(isomorphicEncode, "isomorphicEncode");
4408- async function readAllBytes(reader, shouldClone ) {
4408+ async function readAllBytes(reader) {
44094409 const bytes = [];
44104410 let byteLength = 0;
44114411 while (true) {
44124412 const { done, value: chunk } = await reader.read();
44134413 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- }
44214414 return Buffer.concat(bytes, byteLength);
44224415 }
44234416 if (!isUint8Array(chunk)) {
@@ -5393,18 +5386,18 @@ Content-Type: ${value.type || "application/octet-stream"}\r
53935386 mimeType = serializeAMimeType(mimeType);
53945387 }
53955388 return new Blob2([bytes], { type: mimeType });
5396- }, instance, false );
5389+ }, instance);
53975390 },
53985391 arrayBuffer() {
53995392 return consumeBody(this, (bytes) => {
5400- return bytes.buffer;
5401- }, instance, true );
5393+ return new Uint8Array( bytes) .buffer;
5394+ }, instance);
54025395 },
54035396 text() {
5404- return consumeBody(this, utf8DecodeBytes, instance, false );
5397+ return consumeBody(this, utf8DecodeBytes, instance);
54055398 },
54065399 json() {
5407- return consumeBody(this, parseJSONFromBytes, instance, false );
5400+ return consumeBody(this, parseJSONFromBytes, instance);
54085401 },
54095402 formData() {
54105403 return consumeBody(this, (value) => {
@@ -5433,12 +5426,12 @@ Content-Type: ${value.type || "application/octet-stream"}\r
54335426 throw new TypeError(
54345427 'Content-Type was not one of "multipart/form-data" or "application/x-www-form-urlencoded".'
54355428 );
5436- }, instance, false );
5429+ }, instance);
54375430 },
54385431 bytes() {
54395432 return consumeBody(this, (bytes) => {
5440- return new Uint8Array(bytes.buffer, 0, bytes.byteLength );
5441- }, instance, true );
5433+ return new Uint8Array(bytes);
5434+ }, instance);
54425435 }
54435436 };
54445437 return methods;
@@ -5448,7 +5441,7 @@ Content-Type: ${value.type || "application/octet-stream"}\r
54485441 Object.assign(prototype.prototype, bodyMixinMethods(prototype));
54495442 }
54505443 __name(mixinBody, "mixinBody");
5451- async function consumeBody(object, convertBytesToJSValue, instance, shouldClone ) {
5444+ async function consumeBody(object, convertBytesToJSValue, instance) {
54525445 webidl.brandCheck(object, instance);
54535446 if (bodyUnusable(object[kState].body)) {
54545447 throw new TypeError("Body is unusable: Body has already been read");
@@ -5467,7 +5460,7 @@ Content-Type: ${value.type || "application/octet-stream"}\r
54675460 successSteps(Buffer.allocUnsafe(0));
54685461 return promise.promise;
54695462 }
5470- await fullyReadBody(object[kState].body, successSteps, errorSteps, shouldClone );
5463+ await fullyReadBody(object[kState].body, successSteps, errorSteps);
54715464 return promise.promise;
54725465 }
54735466 __name(consumeBody, "consumeBody");
0 commit comments