urllib 3.22.5 → 3.24.0
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.
@@ -68,7 +68,7 @@ class BlobFromStream {
|
|
68
68
|
return 'Blob';
|
69
69
|
}
|
70
70
|
}
|
71
|
-
exports.HEADER_USER_AGENT = (0, default_user_agent_1.default)('node-urllib', '3.
|
71
|
+
exports.HEADER_USER_AGENT = (0, default_user_agent_1.default)('node-urllib', '3.24.0');
|
72
72
|
function getFileName(stream) {
|
73
73
|
const filePath = stream.path;
|
74
74
|
if (filePath) {
|
@@ -308,6 +308,7 @@ class HttpClient extends node_events_1.EventEmitter {
|
|
308
308
|
bodyTimeout,
|
309
309
|
opaque: internalOpaque,
|
310
310
|
dispatcher: args.dispatcher ?? this.#dispatcher,
|
311
|
+
signal: args.signal,
|
311
312
|
};
|
312
313
|
if (typeof args.highWaterMark === 'number') {
|
313
314
|
requestOptions.highWaterMark = args.highWaterMark;
|
@@ -578,6 +579,7 @@ class HttpClient extends node_events_1.EventEmitter {
|
|
578
579
|
return await this.#requestInternal(url, options, requestContext);
|
579
580
|
}
|
580
581
|
}
|
582
|
+
debug('Request#%d got response, status: %s, headers: %j, timing: %j', requestId, res.status, res.headers, res.timing);
|
581
583
|
channels.response.publish({
|
582
584
|
request: reqMeta,
|
583
585
|
response: res,
|
@@ -1,7 +1,9 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
/// <reference types="node" />
|
3
3
|
/// <reference types="node" />
|
4
|
+
/// <reference types="node" />
|
4
5
|
import type { Readable, Writable } from 'node:stream';
|
6
|
+
import type { EventEmitter } from 'node:events';
|
5
7
|
import type { Dispatcher } from 'undici';
|
6
8
|
import type { IncomingHttpHeaders } from './IncomingHttpHeaders.js';
|
7
9
|
import type { HttpClientResponse } from './Response.js';
|
@@ -9,6 +11,7 @@ export type HttpMethod = Dispatcher.HttpMethod;
|
|
9
11
|
export type RequestURL = string | URL;
|
10
12
|
export type FixJSONCtlCharsHandler = (data: string) => string;
|
11
13
|
export type FixJSONCtlChars = boolean | FixJSONCtlCharsHandler;
|
14
|
+
type AbortSignal = unknown;
|
12
15
|
export type RequestOptions = {
|
13
16
|
/** Request method, defaults to GET. Could be GET, POST, DELETE or PUT. Alias 'type'. */
|
14
17
|
method?: HttpMethod | Lowercase<HttpMethod>;
|
@@ -147,6 +150,7 @@ export type RequestOptions = {
|
|
147
150
|
reset?: boolean;
|
148
151
|
/** Default: `64 KiB` */
|
149
152
|
highWaterMark?: number;
|
153
|
+
signal?: AbortSignal | EventEmitter;
|
150
154
|
};
|
151
155
|
export type RequestMeta = {
|
152
156
|
requestId: number;
|
@@ -155,3 +159,4 @@ export type RequestMeta = {
|
|
155
159
|
ctx?: unknown;
|
156
160
|
retries: number;
|
157
161
|
};
|
162
|
+
export {};
|
package/dist/esm/HttpClient.js
CHANGED
@@ -62,7 +62,7 @@ class BlobFromStream {
|
|
62
62
|
return 'Blob';
|
63
63
|
}
|
64
64
|
}
|
65
|
-
export const HEADER_USER_AGENT = createUserAgent('node-urllib', '3.
|
65
|
+
export const HEADER_USER_AGENT = createUserAgent('node-urllib', '3.24.0');
|
66
66
|
function getFileName(stream) {
|
67
67
|
const filePath = stream.path;
|
68
68
|
if (filePath) {
|
@@ -302,6 +302,7 @@ export class HttpClient extends EventEmitter {
|
|
302
302
|
bodyTimeout,
|
303
303
|
opaque: internalOpaque,
|
304
304
|
dispatcher: args.dispatcher ?? this.#dispatcher,
|
305
|
+
signal: args.signal,
|
305
306
|
};
|
306
307
|
if (typeof args.highWaterMark === 'number') {
|
307
308
|
requestOptions.highWaterMark = args.highWaterMark;
|
@@ -572,6 +573,7 @@ export class HttpClient extends EventEmitter {
|
|
572
573
|
return await this.#requestInternal(url, options, requestContext);
|
573
574
|
}
|
574
575
|
}
|
576
|
+
debug('Request#%d got response, status: %s, headers: %j, timing: %j', requestId, res.status, res.headers, res.timing);
|
575
577
|
channels.response.publish({
|
576
578
|
request: reqMeta,
|
577
579
|
response: res,
|
package/dist/esm/Request.d.ts
CHANGED
@@ -1,7 +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
|
+
/// <reference types="node" resolution-mode="require"/>
|
4
5
|
import type { Readable, Writable } from 'node:stream';
|
6
|
+
import type { EventEmitter } from 'node:events';
|
5
7
|
import type { Dispatcher } from 'undici';
|
6
8
|
import type { IncomingHttpHeaders } from './IncomingHttpHeaders.js';
|
7
9
|
import type { HttpClientResponse } from './Response.js';
|
@@ -9,6 +11,7 @@ export type HttpMethod = Dispatcher.HttpMethod;
|
|
9
11
|
export type RequestURL = string | URL;
|
10
12
|
export type FixJSONCtlCharsHandler = (data: string) => string;
|
11
13
|
export type FixJSONCtlChars = boolean | FixJSONCtlCharsHandler;
|
14
|
+
type AbortSignal = unknown;
|
12
15
|
export type RequestOptions = {
|
13
16
|
/** Request method, defaults to GET. Could be GET, POST, DELETE or PUT. Alias 'type'. */
|
14
17
|
method?: HttpMethod | Lowercase<HttpMethod>;
|
@@ -147,6 +150,7 @@ export type RequestOptions = {
|
|
147
150
|
reset?: boolean;
|
148
151
|
/** Default: `64 KiB` */
|
149
152
|
highWaterMark?: number;
|
153
|
+
signal?: AbortSignal | EventEmitter;
|
150
154
|
};
|
151
155
|
export type RequestMeta = {
|
152
156
|
requestId: number;
|
@@ -155,3 +159,4 @@ export type RequestMeta = {
|
|
155
159
|
ctx?: unknown;
|
156
160
|
retries: number;
|
157
161
|
};
|
162
|
+
export {};
|
package/package.json
CHANGED
package/src/HttpClient.ts
CHANGED
@@ -406,6 +406,7 @@ export class HttpClient extends EventEmitter {
|
|
406
406
|
bodyTimeout,
|
407
407
|
opaque: internalOpaque,
|
408
408
|
dispatcher: args.dispatcher ?? this.#dispatcher,
|
409
|
+
signal: args.signal,
|
409
410
|
};
|
410
411
|
if (typeof args.highWaterMark === 'number') {
|
411
412
|
requestOptions.highWaterMark = args.highWaterMark;
|
@@ -666,6 +667,8 @@ export class HttpClient extends EventEmitter {
|
|
666
667
|
}
|
667
668
|
}
|
668
669
|
|
670
|
+
debug('Request#%d got response, status: %s, headers: %j, timing: %j',
|
671
|
+
requestId, res.status, res.headers, res.timing);
|
669
672
|
channels.response.publish({
|
670
673
|
request: reqMeta,
|
671
674
|
response: res,
|
package/src/Request.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import type { Readable, Writable } from 'node:stream';
|
2
|
+
import type { EventEmitter } from 'node:events';
|
2
3
|
import type { Dispatcher } from 'undici';
|
3
4
|
import type { IncomingHttpHeaders } from './IncomingHttpHeaders.js';
|
4
5
|
import type { HttpClientResponse } from './Response.js';
|
@@ -10,6 +11,8 @@ export type RequestURL = string | URL;
|
|
10
11
|
export type FixJSONCtlCharsHandler = (data: string) => string;
|
11
12
|
export type FixJSONCtlChars = boolean | FixJSONCtlCharsHandler;
|
12
13
|
|
14
|
+
type AbortSignal = unknown;
|
15
|
+
|
13
16
|
export type RequestOptions = {
|
14
17
|
/** Request method, defaults to GET. Could be GET, POST, DELETE or PUT. Alias 'type'. */
|
15
18
|
method?: HttpMethod | Lowercase<HttpMethod>;
|
@@ -148,6 +151,7 @@ export type RequestOptions = {
|
|
148
151
|
reset?: boolean;
|
149
152
|
/** Default: `64 KiB` */
|
150
153
|
highWaterMark?: number;
|
154
|
+
signal?: AbortSignal | EventEmitter;
|
151
155
|
};
|
152
156
|
|
153
157
|
export type RequestMeta = {
|