urllib 3.19.1 → 3.19.2

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.
@@ -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.1');
76
+ exports.HEADER_USER_AGENT = (0, default_user_agent_1.default)('node-urllib', '3.19.2');
77
77
  function getFileName(stream) {
78
78
  const filePath = stream.path;
79
79
  if (filePath) {
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
3
  /// <reference types="node" />
4
- /// <reference types="node" />
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
- /// <reference types="node" />
3
- import { Readable } from 'node:stream';
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;
@@ -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;
@@ -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.1');
70
+ export const HEADER_USER_AGENT = createUserAgent('node-urllib', '3.19.2');
71
71
  function getFileName(stream) {
72
72
  const filePath = stream.path;
73
73
  if (filePath) {
@@ -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 {};
@@ -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
- /// <reference types="node" resolution-mode="require"/>
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" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
- import { Readable } from 'node:stream';
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;
@@ -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.1",
3
+ "version": "3.19.2",
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';
@@ -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
- HttpClientResponse,
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
@@ -1,5 +1,5 @@
1
- import { Readable } from 'node:stream';
2
- import { IncomingHttpHeaders } from 'node:http';
1
+ import type { Readable } from 'node:stream';
2
+ import type { IncomingHttpHeaders } from './IncomingHttpHeaders.js';
3
3
 
4
4
  export type SocketInfo = {
5
5
  id: number;
package/src/index.ts CHANGED
@@ -46,7 +46,13 @@ export {
46
46
  FixJSONCtlCharsHandler, FixJSONCtlChars,
47
47
  } from './Request.js';
48
48
 
49
- export { SocketInfo, Timing, RawResponseWithMeta, HttpClientResponse } from './Response.js';
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,