@whatwg-node/node-fetch 0.5.7 → 0.5.8-alpha-20240312161556-e6d3e27cadcaaa8338844ba5d1ab398c9828c328
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/Headers.js +2 -2
- package/cjs/fetchCurl.js +3 -3
- package/esm/Headers.js +1 -1
- package/esm/fetchCurl.js +1 -1
- package/package.json +1 -1
- package/typings/Request.d.cts +1 -1
- package/typings/Request.d.ts +1 -1
- package/typings/utils.d.cts +1 -1
- package/typings/utils.d.ts +1 -1
package/cjs/Headers.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.PonyfillHeaders = exports.isHeadersLike = void 0;
|
4
|
-
const
|
4
|
+
const util_1 = require("util");
|
5
5
|
function isHeadersLike(headers) {
|
6
6
|
return headers?.get && headers?.forEach;
|
7
7
|
}
|
@@ -238,7 +238,7 @@ class PonyfillHeaders {
|
|
238
238
|
record[key] = value.includes(',') ? value.split(',').map(el => el.trim()) : value;
|
239
239
|
}
|
240
240
|
});
|
241
|
-
return `Headers ${(0,
|
241
|
+
return `Headers ${(0, util_1.inspect)(record)}`;
|
242
242
|
}
|
243
243
|
}
|
244
244
|
exports.PonyfillHeaders = PonyfillHeaders;
|
package/cjs/fetchCurl.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.fetchCurl = void 0;
|
4
|
-
const
|
4
|
+
const stream_1 = require("stream");
|
5
5
|
const Response_js_1 = require("./Response.js");
|
6
6
|
const utils_js_1 = require("./utils.js");
|
7
7
|
function fetchCurl(fetchRequest) {
|
@@ -25,7 +25,7 @@ function fetchCurl(fetchRequest) {
|
|
25
25
|
const nodeReadable = (fetchRequest.body != null
|
26
26
|
? (0, utils_js_1.isNodeReadable)(fetchRequest.body)
|
27
27
|
? fetchRequest.body
|
28
|
-
:
|
28
|
+
: stream_1.Readable.from(fetchRequest.body)
|
29
29
|
: null);
|
30
30
|
if (nodeReadable) {
|
31
31
|
curlHandle.setOpt('UPLOAD', true);
|
@@ -73,7 +73,7 @@ function fetchCurl(fetchRequest) {
|
|
73
73
|
curlHandle.close();
|
74
74
|
});
|
75
75
|
curlHandle.once('stream', function streamListener(stream, status, headersBuf) {
|
76
|
-
const pipedStream = stream.pipe(new
|
76
|
+
const pipedStream = stream.pipe(new stream_1.PassThrough());
|
77
77
|
const headersFlat = headersBuf
|
78
78
|
.toString('utf8')
|
79
79
|
.split(/\r?\n|\r/g)
|
package/esm/Headers.js
CHANGED
package/esm/fetchCurl.js
CHANGED
package/package.json
CHANGED
package/typings/Request.d.cts
CHANGED
@@ -21,7 +21,7 @@ export declare class PonyfillRequest<TJSON = any> extends PonyfillBody<TJSON> im
|
|
21
21
|
keepalive: boolean;
|
22
22
|
method: string;
|
23
23
|
mode: RequestMode;
|
24
|
-
priority:
|
24
|
+
priority: 'auto' | 'high' | 'low';
|
25
25
|
redirect: RequestRedirect;
|
26
26
|
referrer: string;
|
27
27
|
referrerPolicy: ReferrerPolicy;
|
package/typings/Request.d.ts
CHANGED
@@ -21,7 +21,7 @@ export declare class PonyfillRequest<TJSON = any> extends PonyfillBody<TJSON> im
|
|
21
21
|
keepalive: boolean;
|
22
22
|
method: string;
|
23
23
|
mode: RequestMode;
|
24
|
-
priority:
|
24
|
+
priority: 'auto' | 'high' | 'low';
|
25
25
|
redirect: RequestRedirect;
|
26
26
|
referrer: string;
|
27
27
|
referrerPolicy: ReferrerPolicy;
|
package/typings/utils.d.cts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
-
import { Readable } from '
|
2
|
+
import { Readable } from 'stream';
|
3
3
|
export declare function getHeadersObj(headers: Headers): Record<string, string>;
|
4
4
|
export declare function defaultHeadersSerializer(headers: Headers, onContentLength?: (value: string) => void): string[];
|
5
5
|
export declare function fakePromise<T>(value: T): Promise<T>;
|
package/typings/utils.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
-
import { Readable } from '
|
2
|
+
import { Readable } from 'stream';
|
3
3
|
export declare function getHeadersObj(headers: Headers): Record<string, string>;
|
4
4
|
export declare function defaultHeadersSerializer(headers: Headers, onContentLength?: (value: string) => void): string[];
|
5
5
|
export declare function fakePromise<T>(value: T): Promise<T>;
|