@whatwg-node/node-fetch 0.5.6 → 0.5.7-alpha-20240229132341-1e3c1f24effefed571297b2c5001e44cfaefbf60
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/cjs/fetchCurl.js +1 -1
- package/cjs/fetchNodeHttp.js +1 -1
- package/esm/fetchCurl.js +2 -2
- package/esm/fetchNodeHttp.js +2 -2
- package/package.json +1 -1
package/cjs/fetchCurl.js
CHANGED
@@ -88,7 +88,7 @@ function fetchCurl(fetchRequest) {
|
|
88
88
|
return false;
|
89
89
|
});
|
90
90
|
const headersInit = headersFlat.map(headerFlat => headerFlat.split(/:\s(.+)/).slice(0, 2));
|
91
|
-
resolve(new Response_js_1.PonyfillResponse(stream, {
|
91
|
+
resolve(new Response_js_1.PonyfillResponse(stream.pipe(new node_stream_1.PassThrough()), {
|
92
92
|
status,
|
93
93
|
headers: headersInit,
|
94
94
|
url: fetchRequest.url,
|
package/cjs/fetchNodeHttp.js
CHANGED
@@ -36,7 +36,7 @@ function fetchNodeHttp(fetchRequest) {
|
|
36
36
|
agent: fetchRequest.agent,
|
37
37
|
});
|
38
38
|
nodeRequest.once('response', nodeResponse => {
|
39
|
-
let responseBody = nodeResponse;
|
39
|
+
let responseBody = nodeResponse.pipe(new stream_1.PassThrough());
|
40
40
|
const contentEncoding = nodeResponse.headers['content-encoding'];
|
41
41
|
switch (contentEncoding) {
|
42
42
|
case 'x-gzip':
|
package/esm/fetchCurl.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Readable } from 'node:stream';
|
1
|
+
import { PassThrough, Readable } from 'node:stream';
|
2
2
|
import { PonyfillResponse } from './Response.js';
|
3
3
|
import { defaultHeadersSerializer, isNodeReadable } from './utils.js';
|
4
4
|
export function fetchCurl(fetchRequest) {
|
@@ -85,7 +85,7 @@ export function fetchCurl(fetchRequest) {
|
|
85
85
|
return false;
|
86
86
|
});
|
87
87
|
const headersInit = headersFlat.map(headerFlat => headerFlat.split(/:\s(.+)/).slice(0, 2));
|
88
|
-
resolve(new PonyfillResponse(stream, {
|
88
|
+
resolve(new PonyfillResponse(stream.pipe(new PassThrough()), {
|
89
89
|
status,
|
90
90
|
headers: headersInit,
|
91
91
|
url: fetchRequest.url,
|
package/esm/fetchNodeHttp.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { request as httpRequest } from 'http';
|
2
2
|
import { request as httpsRequest } from 'https';
|
3
|
-
import { Readable } from 'stream';
|
3
|
+
import { PassThrough, Readable } from 'stream';
|
4
4
|
import { createBrotliDecompress, createGunzip, createInflate } from 'zlib';
|
5
5
|
import { PonyfillRequest } from './Request.js';
|
6
6
|
import { PonyfillResponse } from './Response.js';
|
@@ -33,7 +33,7 @@ export function fetchNodeHttp(fetchRequest) {
|
|
33
33
|
agent: fetchRequest.agent,
|
34
34
|
});
|
35
35
|
nodeRequest.once('response', nodeResponse => {
|
36
|
-
let responseBody = nodeResponse;
|
36
|
+
let responseBody = nodeResponse.pipe(new PassThrough());
|
37
37
|
const contentEncoding = nodeResponse.headers['content-encoding'];
|
38
38
|
switch (contentEncoding) {
|
39
39
|
case 'x-gzip':
|
package/package.json
CHANGED