@whatwg-node/node-fetch 0.7.6-alpha-20250103123055-7d3b49ae3cf2bf03e15b5c69c5a0b590eb1a0232 → 0.7.6-alpha-20250106140930-8f2bc40b53a3e961bb9767f6e5d6ae64f5bf9866
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/fetchNodeHttp.js +7 -2
- package/esm/fetchNodeHttp.js +8 -3
- package/package.json +1 -1
- package/typings/Request.d.cts +6 -6
- package/typings/Request.d.ts +6 -6
- package/typings/Response.d.cts +5 -5
- package/typings/Response.d.ts +5 -5
package/cjs/fetchNodeHttp.js
CHANGED
@@ -101,9 +101,14 @@ function fetchNodeHttp(fetchRequest) {
|
|
101
101
|
}
|
102
102
|
})
|
103
103
|
.catch(reject);
|
104
|
+
const statusCode = nodeResponse.statusCode || 200;
|
105
|
+
let statusText = nodeResponse.statusMessage || http_1.STATUS_CODES[statusCode];
|
106
|
+
if (statusText == null) {
|
107
|
+
statusText = '';
|
108
|
+
}
|
104
109
|
const ponyfillResponse = new Response_js_1.PonyfillResponse(outputStream, {
|
105
|
-
status:
|
106
|
-
statusText
|
110
|
+
status: statusCode,
|
111
|
+
statusText,
|
107
112
|
headers: nodeResponse.headers,
|
108
113
|
url: fetchRequest.url,
|
109
114
|
});
|
package/esm/fetchNodeHttp.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { request as httpRequest } from 'http';
|
1
|
+
import { request as httpRequest, STATUS_CODES } from 'http';
|
2
2
|
import { request as httpsRequest } from 'https';
|
3
3
|
import { PassThrough, Readable, promises as streamPromises } from 'stream';
|
4
4
|
import { createBrotliDecompress, createGunzip, createInflate, createInflateRaw } from 'zlib';
|
@@ -98,9 +98,14 @@ export function fetchNodeHttp(fetchRequest) {
|
|
98
98
|
}
|
99
99
|
})
|
100
100
|
.catch(reject);
|
101
|
+
const statusCode = nodeResponse.statusCode || 200;
|
102
|
+
let statusText = nodeResponse.statusMessage || STATUS_CODES[statusCode];
|
103
|
+
if (statusText == null) {
|
104
|
+
statusText = '';
|
105
|
+
}
|
101
106
|
const ponyfillResponse = new PonyfillResponse(outputStream, {
|
102
|
-
status:
|
103
|
-
statusText
|
107
|
+
status: statusCode,
|
108
|
+
statusText,
|
104
109
|
headers: nodeResponse.headers,
|
105
110
|
url: fetchRequest.url,
|
106
111
|
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@whatwg-node/node-fetch",
|
3
|
-
"version": "0.7.6-alpha-
|
3
|
+
"version": "0.7.6-alpha-20250106140930-8f2bc40b53a3e961bb9767f6e5d6ae64f5bf9866",
|
4
4
|
"description": "Fetch API implementation for Node",
|
5
5
|
"sideEffects": false,
|
6
6
|
"dependencies": {
|
package/typings/Request.d.cts
CHANGED
@@ -3,16 +3,16 @@ import { Agent as HTTPSAgent } from 'https';
|
|
3
3
|
import { BodyPonyfillInit, PonyfillBody, PonyfillBodyOptions } from './Body.cjs';
|
4
4
|
import { PonyfillHeadersInit } from './Headers.cjs';
|
5
5
|
export type RequestPonyfillInit = PonyfillBodyOptions & Omit<RequestInit, 'body' | 'headers'> & {
|
6
|
-
body?: BodyPonyfillInit | null;
|
7
|
-
duplex?: 'half' | 'full';
|
8
|
-
headers?: PonyfillHeadersInit;
|
9
|
-
headersSerializer?: HeadersSerializer;
|
10
|
-
agent?: HTTPAgent | HTTPSAgent | false;
|
6
|
+
body?: BodyPonyfillInit | null | undefined;
|
7
|
+
duplex?: 'half' | 'full' | undefined;
|
8
|
+
headers?: PonyfillHeadersInit | undefined;
|
9
|
+
headersSerializer?: HeadersSerializer | undefined;
|
10
|
+
agent?: HTTPAgent | HTTPSAgent | false | undefined;
|
11
11
|
};
|
12
12
|
type HeadersSerializer = (headers: Headers, onContentLength?: (contentLength: string) => void) => string[];
|
13
13
|
export declare class PonyfillRequest<TJSON = any> extends PonyfillBody<TJSON> implements Request {
|
14
14
|
constructor(input: RequestInfo | URL, options?: RequestPonyfillInit);
|
15
|
-
headersSerializer?: HeadersSerializer;
|
15
|
+
headersSerializer?: HeadersSerializer | undefined;
|
16
16
|
cache: RequestCache;
|
17
17
|
credentials: RequestCredentials;
|
18
18
|
destination: RequestDestination;
|
package/typings/Request.d.ts
CHANGED
@@ -3,16 +3,16 @@ import { Agent as HTTPSAgent } from 'https';
|
|
3
3
|
import { BodyPonyfillInit, PonyfillBody, PonyfillBodyOptions } from './Body.js';
|
4
4
|
import { PonyfillHeadersInit } from './Headers.js';
|
5
5
|
export type RequestPonyfillInit = PonyfillBodyOptions & Omit<RequestInit, 'body' | 'headers'> & {
|
6
|
-
body?: BodyPonyfillInit | null;
|
7
|
-
duplex?: 'half' | 'full';
|
8
|
-
headers?: PonyfillHeadersInit;
|
9
|
-
headersSerializer?: HeadersSerializer;
|
10
|
-
agent?: HTTPAgent | HTTPSAgent | false;
|
6
|
+
body?: BodyPonyfillInit | null | undefined;
|
7
|
+
duplex?: 'half' | 'full' | undefined;
|
8
|
+
headers?: PonyfillHeadersInit | undefined;
|
9
|
+
headersSerializer?: HeadersSerializer | undefined;
|
10
|
+
agent?: HTTPAgent | HTTPSAgent | false | undefined;
|
11
11
|
};
|
12
12
|
type HeadersSerializer = (headers: Headers, onContentLength?: (contentLength: string) => void) => string[];
|
13
13
|
export declare class PonyfillRequest<TJSON = any> extends PonyfillBody<TJSON> implements Request {
|
14
14
|
constructor(input: RequestInfo | URL, options?: RequestPonyfillInit);
|
15
|
-
headersSerializer?: HeadersSerializer;
|
15
|
+
headersSerializer?: HeadersSerializer | undefined;
|
16
16
|
cache: RequestCache;
|
17
17
|
credentials: RequestCredentials;
|
18
18
|
destination: RequestDestination;
|
package/typings/Response.d.cts
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
import { BodyPonyfillInit, PonyfillBody, PonyfillBodyOptions } from './Body.cjs';
|
2
2
|
import { PonyfillHeadersInit } from './Headers.cjs';
|
3
3
|
export type ResponsePonyfilInit = PonyfillBodyOptions & Omit<ResponseInit, 'headers'> & {
|
4
|
-
url?: string;
|
5
|
-
redirected?: boolean;
|
6
|
-
headers?: PonyfillHeadersInit;
|
7
|
-
type?: ResponseType;
|
4
|
+
url?: string | undefined;
|
5
|
+
redirected?: boolean | undefined;
|
6
|
+
headers?: PonyfillHeadersInit | undefined;
|
7
|
+
type?: ResponseType | undefined;
|
8
8
|
};
|
9
9
|
export declare class PonyfillResponse<TJSON = any> extends PonyfillBody<TJSON> implements Response {
|
10
10
|
headers: Headers;
|
11
|
-
constructor(body?: BodyPonyfillInit | null, init?: ResponsePonyfilInit);
|
11
|
+
constructor(body?: BodyPonyfillInit | null | undefined, init?: ResponsePonyfilInit);
|
12
12
|
get ok(): boolean;
|
13
13
|
status: number;
|
14
14
|
statusText: string;
|
package/typings/Response.d.ts
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
import { BodyPonyfillInit, PonyfillBody, PonyfillBodyOptions } from './Body.js';
|
2
2
|
import { PonyfillHeadersInit } from './Headers.js';
|
3
3
|
export type ResponsePonyfilInit = PonyfillBodyOptions & Omit<ResponseInit, 'headers'> & {
|
4
|
-
url?: string;
|
5
|
-
redirected?: boolean;
|
6
|
-
headers?: PonyfillHeadersInit;
|
7
|
-
type?: ResponseType;
|
4
|
+
url?: string | undefined;
|
5
|
+
redirected?: boolean | undefined;
|
6
|
+
headers?: PonyfillHeadersInit | undefined;
|
7
|
+
type?: ResponseType | undefined;
|
8
8
|
};
|
9
9
|
export declare class PonyfillResponse<TJSON = any> extends PonyfillBody<TJSON> implements Response {
|
10
10
|
headers: Headers;
|
11
|
-
constructor(body?: BodyPonyfillInit | null, init?: ResponsePonyfilInit);
|
11
|
+
constructor(body?: BodyPonyfillInit | null | undefined, init?: ResponsePonyfilInit);
|
12
12
|
get ok(): boolean;
|
13
13
|
status: number;
|
14
14
|
statusText: string;
|