@whatwg-node/node-fetch 0.0.3-alpha-20230205160326-cd8fd84 → 0.0.3-alpha-20230205160404-daaf017
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +9 -7
- package/index.mjs +9 -7
- package/package.json +1 -1
package/index.js
CHANGED
@@ -419,7 +419,9 @@ class PonyfillBody {
|
|
419
419
|
if (this.bodyType === BodyInitType.Blob) {
|
420
420
|
return this.bodyInit;
|
421
421
|
}
|
422
|
-
if (this.bodyType === BodyInitType.String ||
|
422
|
+
if (this.bodyType === BodyInitType.String ||
|
423
|
+
this.bodyType === BodyInitType.Buffer ||
|
424
|
+
this.bodyType === BodyInitType.Uint8Array) {
|
423
425
|
const bodyInitTyped = this.bodyInit;
|
424
426
|
return new PonyfillBlob([bodyInitTyped], {
|
425
427
|
type: this.contentType || '',
|
@@ -611,7 +613,7 @@ function processBodyInit(bodyInit) {
|
|
611
613
|
const readable = stream.Readable.from(bodyInit);
|
612
614
|
const body = new PonyfillReadableStream(readable);
|
613
615
|
return body;
|
614
|
-
}
|
616
|
+
},
|
615
617
|
};
|
616
618
|
}
|
617
619
|
if ('buffer' in bodyInit) {
|
@@ -624,7 +626,7 @@ function processBodyInit(bodyInit) {
|
|
624
626
|
const readable = stream.Readable.from(buffer);
|
625
627
|
const body = new PonyfillReadableStream(readable);
|
626
628
|
return body;
|
627
|
-
}
|
629
|
+
},
|
628
630
|
};
|
629
631
|
}
|
630
632
|
if (bodyInit instanceof ArrayBuffer) {
|
@@ -638,7 +640,7 @@ function processBodyInit(bodyInit) {
|
|
638
640
|
const readable = stream.Readable.from(buffer);
|
639
641
|
const body = new PonyfillReadableStream(readable);
|
640
642
|
return body;
|
641
|
-
}
|
643
|
+
},
|
642
644
|
};
|
643
645
|
}
|
644
646
|
if (bodyInit instanceof stream.Readable) {
|
@@ -649,7 +651,7 @@ function processBodyInit(bodyInit) {
|
|
649
651
|
bodyFactory() {
|
650
652
|
const body = new PonyfillReadableStream(bodyInit);
|
651
653
|
return body;
|
652
|
-
}
|
654
|
+
},
|
653
655
|
};
|
654
656
|
}
|
655
657
|
if ('stream' in bodyInit) {
|
@@ -660,7 +662,7 @@ function processBodyInit(bodyInit) {
|
|
660
662
|
const bodyStream = bodyInit.stream();
|
661
663
|
const body = new PonyfillReadableStream(bodyStream);
|
662
664
|
return body;
|
663
|
-
}
|
665
|
+
},
|
664
666
|
};
|
665
667
|
}
|
666
668
|
if (bodyInit instanceof URLSearchParams) {
|
@@ -672,7 +674,7 @@ function processBodyInit(bodyInit) {
|
|
672
674
|
bodyFactory() {
|
673
675
|
const body = new PonyfillReadableStream(stream.Readable.from(bodyInit.toString()));
|
674
676
|
return body;
|
675
|
-
}
|
677
|
+
},
|
676
678
|
};
|
677
679
|
}
|
678
680
|
if ('forEach' in bodyInit) {
|
package/index.mjs
CHANGED
@@ -413,7 +413,9 @@ class PonyfillBody {
|
|
413
413
|
if (this.bodyType === BodyInitType.Blob) {
|
414
414
|
return this.bodyInit;
|
415
415
|
}
|
416
|
-
if (this.bodyType === BodyInitType.String ||
|
416
|
+
if (this.bodyType === BodyInitType.String ||
|
417
|
+
this.bodyType === BodyInitType.Buffer ||
|
418
|
+
this.bodyType === BodyInitType.Uint8Array) {
|
417
419
|
const bodyInitTyped = this.bodyInit;
|
418
420
|
return new PonyfillBlob([bodyInitTyped], {
|
419
421
|
type: this.contentType || '',
|
@@ -605,7 +607,7 @@ function processBodyInit(bodyInit) {
|
|
605
607
|
const readable = Readable.from(bodyInit);
|
606
608
|
const body = new PonyfillReadableStream(readable);
|
607
609
|
return body;
|
608
|
-
}
|
610
|
+
},
|
609
611
|
};
|
610
612
|
}
|
611
613
|
if ('buffer' in bodyInit) {
|
@@ -618,7 +620,7 @@ function processBodyInit(bodyInit) {
|
|
618
620
|
const readable = Readable.from(buffer);
|
619
621
|
const body = new PonyfillReadableStream(readable);
|
620
622
|
return body;
|
621
|
-
}
|
623
|
+
},
|
622
624
|
};
|
623
625
|
}
|
624
626
|
if (bodyInit instanceof ArrayBuffer) {
|
@@ -632,7 +634,7 @@ function processBodyInit(bodyInit) {
|
|
632
634
|
const readable = Readable.from(buffer);
|
633
635
|
const body = new PonyfillReadableStream(readable);
|
634
636
|
return body;
|
635
|
-
}
|
637
|
+
},
|
636
638
|
};
|
637
639
|
}
|
638
640
|
if (bodyInit instanceof Readable) {
|
@@ -643,7 +645,7 @@ function processBodyInit(bodyInit) {
|
|
643
645
|
bodyFactory() {
|
644
646
|
const body = new PonyfillReadableStream(bodyInit);
|
645
647
|
return body;
|
646
|
-
}
|
648
|
+
},
|
647
649
|
};
|
648
650
|
}
|
649
651
|
if ('stream' in bodyInit) {
|
@@ -654,7 +656,7 @@ function processBodyInit(bodyInit) {
|
|
654
656
|
const bodyStream = bodyInit.stream();
|
655
657
|
const body = new PonyfillReadableStream(bodyStream);
|
656
658
|
return body;
|
657
|
-
}
|
659
|
+
},
|
658
660
|
};
|
659
661
|
}
|
660
662
|
if (bodyInit instanceof URLSearchParams) {
|
@@ -666,7 +668,7 @@ function processBodyInit(bodyInit) {
|
|
666
668
|
bodyFactory() {
|
667
669
|
const body = new PonyfillReadableStream(Readable.from(bodyInit.toString()));
|
668
670
|
return body;
|
669
|
-
}
|
671
|
+
},
|
670
672
|
};
|
671
673
|
}
|
672
674
|
if ('forEach' in bodyInit) {
|
package/package.json
CHANGED