urllib 3.19.1 → 3.19.3
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/README.md +1 -1
- package/dist/commonjs/HttpClient.js +3 -2
- package/dist/commonjs/IncomingHttpHeaders.d.ts +6 -0
- package/dist/commonjs/IncomingHttpHeaders.js +2 -0
- package/dist/commonjs/Request.d.ts +2 -3
- package/dist/commonjs/Response.d.ts +2 -3
- package/dist/commonjs/index.d.ts +2 -1
- package/dist/esm/HttpClient.js +3 -2
- package/dist/esm/IncomingHttpHeaders.d.ts +6 -0
- package/dist/esm/IncomingHttpHeaders.js +1 -0
- package/dist/esm/Request.d.ts +2 -3
- package/dist/esm/Response.d.ts +2 -3
- package/dist/esm/index.d.ts +2 -1
- package/package.json +2 -1
- package/src/HttpClient.ts +3 -2
- package/src/IncomingHttpHeaders.ts +7 -0
- package/src/Request.ts +3 -5
- package/src/Response.ts +2 -2
- package/src/index.ts +7 -1
package/README.md
CHANGED
@@ -73,7 +73,7 @@ class HttpClientRequestTimeoutError extends Error {
|
|
73
73
|
Error.captureStackTrace(this, this.constructor);
|
74
74
|
}
|
75
75
|
}
|
76
|
-
exports.HEADER_USER_AGENT = (0, default_user_agent_1.default)('node-urllib', '3.19.
|
76
|
+
exports.HEADER_USER_AGENT = (0, default_user_agent_1.default)('node-urllib', '3.19.3');
|
77
77
|
function getFileName(stream) {
|
78
78
|
const filePath = stream.path;
|
79
79
|
if (filePath) {
|
@@ -126,7 +126,8 @@ class HttpClient extends node_events_1.EventEmitter {
|
|
126
126
|
requestUrl = new URL((0, node_url_1.format)(url));
|
127
127
|
}
|
128
128
|
else {
|
129
|
-
|
129
|
+
// or even if not, we clone to avoid mutating it
|
130
|
+
requestUrl = new URL(url.toString());
|
130
131
|
}
|
131
132
|
}
|
132
133
|
const method = (options?.method ?? 'GET').toUpperCase();
|
@@ -0,0 +1,6 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import type { Except } from 'type-fest';
|
3
|
+
import type { IncomingHttpHeaders as HTTPIncomingHttpHeaders } from 'node:http';
|
4
|
+
export interface IncomingHttpHeaders extends Except<HTTPIncomingHttpHeaders, 'set-cookie'> {
|
5
|
+
'set-cookie'?: string | string[];
|
6
|
+
}
|
@@ -1,10 +1,9 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
/// <reference types="node" />
|
3
3
|
/// <reference types="node" />
|
4
|
-
|
5
|
-
import { Readable, Writable } from 'node:stream';
|
6
|
-
import type { IncomingHttpHeaders } from 'node:http';
|
4
|
+
import type { Readable, Writable } from 'node:stream';
|
7
5
|
import type { Dispatcher } from 'undici';
|
6
|
+
import type { IncomingHttpHeaders } from './IncomingHttpHeaders.js';
|
8
7
|
import type { HttpClientResponse } from './Response.js';
|
9
8
|
export type HttpMethod = Dispatcher.HttpMethod;
|
10
9
|
export type RequestURL = string | URL;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
-
|
3
|
-
import {
|
4
|
-
import { IncomingHttpHeaders } from 'node:http';
|
2
|
+
import type { Readable } from 'node:stream';
|
3
|
+
import type { IncomingHttpHeaders } from './IncomingHttpHeaders.js';
|
5
4
|
export type SocketInfo = {
|
6
5
|
id: number;
|
7
6
|
localAddress: string;
|
package/dist/commonjs/index.d.ts
CHANGED
@@ -4,7 +4,8 @@ export declare function curl<T = any>(url: RequestURL, options?: RequestOptions)
|
|
4
4
|
export { MockAgent, ProxyAgent, Agent, Dispatcher, setGlobalDispatcher, getGlobalDispatcher, } from 'undici';
|
5
5
|
export { HttpClient, HttpClient as HttpClient2, HEADER_USER_AGENT as USER_AGENT, RequestDiagnosticsMessage, ResponseDiagnosticsMessage, } from './HttpClient.js';
|
6
6
|
export { RequestOptions, RequestOptions as RequestOptions2, RequestURL, HttpMethod, FixJSONCtlCharsHandler, FixJSONCtlChars, } from './Request.js';
|
7
|
-
export { SocketInfo, Timing, RawResponseWithMeta, HttpClientResponse } from './Response.js';
|
7
|
+
export { SocketInfo, Timing, RawResponseWithMeta, HttpClientResponse, } from './Response.js';
|
8
|
+
export { IncomingHttpHeaders, } from './IncomingHttpHeaders.js';
|
8
9
|
declare const _default: {
|
9
10
|
request: typeof request;
|
10
11
|
curl: typeof curl;
|
package/dist/esm/HttpClient.js
CHANGED
@@ -67,7 +67,7 @@ class HttpClientRequestTimeoutError extends Error {
|
|
67
67
|
Error.captureStackTrace(this, this.constructor);
|
68
68
|
}
|
69
69
|
}
|
70
|
-
export const HEADER_USER_AGENT = createUserAgent('node-urllib', '3.19.
|
70
|
+
export const HEADER_USER_AGENT = createUserAgent('node-urllib', '3.19.3');
|
71
71
|
function getFileName(stream) {
|
72
72
|
const filePath = stream.path;
|
73
73
|
if (filePath) {
|
@@ -120,7 +120,8 @@ export class HttpClient extends EventEmitter {
|
|
120
120
|
requestUrl = new URL(urlFormat(url));
|
121
121
|
}
|
122
122
|
else {
|
123
|
-
|
123
|
+
// or even if not, we clone to avoid mutating it
|
124
|
+
requestUrl = new URL(url.toString());
|
124
125
|
}
|
125
126
|
}
|
126
127
|
const method = (options?.method ?? 'GET').toUpperCase();
|
@@ -0,0 +1,6 @@
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
2
|
+
import type { Except } from 'type-fest';
|
3
|
+
import type { IncomingHttpHeaders as HTTPIncomingHttpHeaders } from 'node:http';
|
4
|
+
export interface IncomingHttpHeaders extends Except<HTTPIncomingHttpHeaders, 'set-cookie'> {
|
5
|
+
'set-cookie'?: string | string[];
|
6
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/dist/esm/Request.d.ts
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
3
3
|
/// <reference types="node" resolution-mode="require"/>
|
4
|
-
|
5
|
-
import { Readable, Writable } from 'node:stream';
|
6
|
-
import type { IncomingHttpHeaders } from 'node:http';
|
4
|
+
import type { Readable, Writable } from 'node:stream';
|
7
5
|
import type { Dispatcher } from 'undici';
|
6
|
+
import type { IncomingHttpHeaders } from './IncomingHttpHeaders.js';
|
8
7
|
import type { HttpClientResponse } from './Response.js';
|
9
8
|
export type HttpMethod = Dispatcher.HttpMethod;
|
10
9
|
export type RequestURL = string | URL;
|
package/dist/esm/Response.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
2
|
-
|
3
|
-
import {
|
4
|
-
import { IncomingHttpHeaders } from 'node:http';
|
2
|
+
import type { Readable } from 'node:stream';
|
3
|
+
import type { IncomingHttpHeaders } from './IncomingHttpHeaders.js';
|
5
4
|
export type SocketInfo = {
|
6
5
|
id: number;
|
7
6
|
localAddress: string;
|
package/dist/esm/index.d.ts
CHANGED
@@ -4,7 +4,8 @@ export declare function curl<T = any>(url: RequestURL, options?: RequestOptions)
|
|
4
4
|
export { MockAgent, ProxyAgent, Agent, Dispatcher, setGlobalDispatcher, getGlobalDispatcher, } from 'undici';
|
5
5
|
export { HttpClient, HttpClient as HttpClient2, HEADER_USER_AGENT as USER_AGENT, RequestDiagnosticsMessage, ResponseDiagnosticsMessage, } from './HttpClient.js';
|
6
6
|
export { RequestOptions, RequestOptions as RequestOptions2, RequestURL, HttpMethod, FixJSONCtlCharsHandler, FixJSONCtlChars, } from './Request.js';
|
7
|
-
export { SocketInfo, Timing, RawResponseWithMeta, HttpClientResponse } from './Response.js';
|
7
|
+
export { SocketInfo, Timing, RawResponseWithMeta, HttpClientResponse, } from './Response.js';
|
8
|
+
export { IncomingHttpHeaders, } from './IncomingHttpHeaders.js';
|
8
9
|
declare const _default: {
|
9
10
|
request: typeof request;
|
10
11
|
curl: typeof curl;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "urllib",
|
3
|
-
"version": "3.19.
|
3
|
+
"version": "3.19.3",
|
4
4
|
"publishConfig": {
|
5
5
|
"tag": "latest"
|
6
6
|
},
|
@@ -76,6 +76,7 @@
|
|
76
76
|
"mime-types": "^2.1.35",
|
77
77
|
"pump": "^3.0.0",
|
78
78
|
"qs": "^6.11.2",
|
79
|
+
"type-fest": "^4.3.1",
|
79
80
|
"undici": "^5.22.1",
|
80
81
|
"ylru": "^1.3.2"
|
81
82
|
},
|
package/src/HttpClient.ts
CHANGED
@@ -2,7 +2,6 @@ import diagnosticsChannel from 'node:diagnostics_channel';
|
|
2
2
|
import { EventEmitter } from 'node:events';
|
3
3
|
import { LookupFunction } from 'node:net';
|
4
4
|
import { STATUS_CODES } from 'node:http';
|
5
|
-
import type { IncomingHttpHeaders } from 'node:http';
|
6
5
|
import { debuglog } from 'node:util';
|
7
6
|
import {
|
8
7
|
createGunzip,
|
@@ -31,6 +30,7 @@ import pump from 'pump';
|
|
31
30
|
// Compatible with old style formstream
|
32
31
|
import FormStream from 'formstream';
|
33
32
|
import { HttpAgent, CheckAddressFunction } from './HttpAgent.js';
|
33
|
+
import type { IncomingHttpHeaders } from './IncomingHttpHeaders.js';
|
34
34
|
import { RequestURL, RequestOptions, HttpMethod, RequestMeta } from './Request.js';
|
35
35
|
import { RawResponseWithMeta, HttpClientResponse, SocketInfo } from './Response.js';
|
36
36
|
import { parseJSON, sleep, digestAuthHeader, globalId, performanceTime, isReadable } from './utils.js';
|
@@ -201,7 +201,8 @@ export class HttpClient extends EventEmitter {
|
|
201
201
|
// url maybe url.parse(url) object in urllib2
|
202
202
|
requestUrl = new URL(urlFormat(url));
|
203
203
|
} else {
|
204
|
-
|
204
|
+
// or even if not, we clone to avoid mutating it
|
205
|
+
requestUrl = new URL(url.toString());
|
205
206
|
}
|
206
207
|
}
|
207
208
|
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { Except } from 'type-fest';
|
2
|
+
import type { IncomingHttpHeaders as HTTPIncomingHttpHeaders } from 'node:http';
|
3
|
+
|
4
|
+
// fix set-cookie type define https://github.com/nodejs/undici/pull/1893
|
5
|
+
export interface IncomingHttpHeaders extends Except<HTTPIncomingHttpHeaders, 'set-cookie'> {
|
6
|
+
'set-cookie'?: string | string[];
|
7
|
+
}
|
package/src/Request.ts
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
import { Readable, Writable } from 'node:stream';
|
2
|
-
import type { IncomingHttpHeaders } from 'node:http';
|
1
|
+
import type { Readable, Writable } from 'node:stream';
|
3
2
|
import type { Dispatcher } from 'undici';
|
4
|
-
import type {
|
5
|
-
|
6
|
-
} from './Response.js';
|
3
|
+
import type { IncomingHttpHeaders } from './IncomingHttpHeaders.js';
|
4
|
+
import type { HttpClientResponse } from './Response.js';
|
7
5
|
|
8
6
|
export type HttpMethod = Dispatcher.HttpMethod;
|
9
7
|
|
package/src/Response.ts
CHANGED
package/src/index.ts
CHANGED
@@ -46,7 +46,13 @@ export {
|
|
46
46
|
FixJSONCtlCharsHandler, FixJSONCtlChars,
|
47
47
|
} from './Request.js';
|
48
48
|
|
49
|
-
export {
|
49
|
+
export {
|
50
|
+
SocketInfo, Timing, RawResponseWithMeta, HttpClientResponse,
|
51
|
+
} from './Response.js';
|
52
|
+
export {
|
53
|
+
IncomingHttpHeaders,
|
54
|
+
} from './IncomingHttpHeaders.js';
|
55
|
+
|
50
56
|
|
51
57
|
export default {
|
52
58
|
request,
|