undici 6.16.0 → 6.17.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.
- package/docs/docs/api/Dispatcher.md +32 -0
- package/index-fetch.js +1 -1
- package/index.js +3 -2
- package/lib/api/api-request.js +10 -1
- package/lib/core/connect.js +1 -1
- package/lib/core/symbols.js +0 -1
- package/lib/dispatcher/client-h1.js +1 -1
- package/lib/interceptor/dump.js +123 -0
- package/lib/web/cookies/util.js +5 -3
- package/lib/web/fetch/body.js +9 -0
- package/lib/web/fetch/headers.js +59 -31
- package/lib/web/fetch/index.js +1 -2
- package/lib/web/fetch/request.js +11 -11
- package/lib/web/fetch/response.js +8 -8
- package/lib/web/fetch/symbols.js +0 -1
- package/lib/web/fetch/util.js +20 -12
- package/lib/web/websocket/connection.js +6 -10
- package/lib/web/websocket/receiver.js +177 -146
- package/lib/web/websocket/util.js +29 -1
- package/lib/web/websocket/websocket.js +17 -5
- package/package.json +4 -2
- package/types/dispatcher.d.ts +3 -3
- package/types/index.d.ts +5 -0
- package/types/interceptors.d.ts +8 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "undici",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.17.0",
|
|
4
4
|
"description": "An HTTP/1.1 client, written from scratch for Node.js",
|
|
5
5
|
"homepage": "https://undici.nodejs.org",
|
|
6
6
|
"bugs": {
|
|
@@ -88,6 +88,8 @@
|
|
|
88
88
|
"test:typescript": "tsd && tsc --skipLibCheck test/imports/undici-import.ts",
|
|
89
89
|
"test:webidl": "borp -p \"test/webidl/*.js\"",
|
|
90
90
|
"test:websocket": "borp -p \"test/websocket/*.js\"",
|
|
91
|
+
"test:websocket:autobahn": "node test/autobahn/client.js",
|
|
92
|
+
"test:websocket:autobahn:report": "node test/autobahn/report.js",
|
|
91
93
|
"test:wpt": "node test/wpt/start-fetch.mjs && node test/wpt/start-FileAPI.mjs && node test/wpt/start-mimesniff.mjs && node test/wpt/start-xhr.mjs && node test/wpt/start-websockets.mjs && node test/wpt/start-cacheStorage.mjs && node test/wpt/start-eventsource.mjs",
|
|
92
94
|
"test:wpt:withoutintl": "node test/wpt/start-fetch.mjs && node test/wpt/start-mimesniff.mjs && node test/wpt/start-xhr.mjs && node test/wpt/start-cacheStorage.mjs && node test/wpt/start-eventsource.mjs",
|
|
93
95
|
"coverage": "npm run coverage:clean && cross-env NODE_V8_COVERAGE=./coverage/tmp npm run test:javascript && npm run coverage:report",
|
|
@@ -135,7 +137,7 @@
|
|
|
135
137
|
"ignore": [
|
|
136
138
|
"lib/llhttp/constants.js",
|
|
137
139
|
"lib/llhttp/utils.js",
|
|
138
|
-
"test/wpt
|
|
140
|
+
"test/fixtures/wpt"
|
|
139
141
|
]
|
|
140
142
|
},
|
|
141
143
|
"tsd": {
|
package/types/dispatcher.d.ts
CHANGED
|
@@ -19,8 +19,8 @@ declare class Dispatcher extends EventEmitter {
|
|
|
19
19
|
connect(options: Dispatcher.ConnectOptions): Promise<Dispatcher.ConnectData>;
|
|
20
20
|
connect(options: Dispatcher.ConnectOptions, callback: (err: Error | null, data: Dispatcher.ConnectData) => void): void;
|
|
21
21
|
/** Compose a chain of dispatchers */
|
|
22
|
-
compose(dispatchers: Dispatcher.
|
|
23
|
-
compose(...dispatchers: Dispatcher.
|
|
22
|
+
compose(dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher;
|
|
23
|
+
compose(...dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher;
|
|
24
24
|
/** Performs an HTTP request. */
|
|
25
25
|
request(options: Dispatcher.RequestOptions): Promise<Dispatcher.ResponseData>;
|
|
26
26
|
request(options: Dispatcher.RequestOptions, callback: (err: Error | null, data: Dispatcher.ResponseData) => void): void;
|
|
@@ -97,7 +97,7 @@ declare class Dispatcher extends EventEmitter {
|
|
|
97
97
|
|
|
98
98
|
declare namespace Dispatcher {
|
|
99
99
|
export interface ComposedDispatcher extends Dispatcher {}
|
|
100
|
-
export type
|
|
100
|
+
export type DispatcherComposeInterceptor = (dispatch: Dispatcher['dispatch']) => Dispatcher['dispatch'];
|
|
101
101
|
export interface DispatchOptions {
|
|
102
102
|
origin?: string | URL;
|
|
103
103
|
path: string;
|
package/types/index.d.ts
CHANGED
|
@@ -66,4 +66,9 @@ declare namespace Undici {
|
|
|
66
66
|
var File: typeof import('./file').File;
|
|
67
67
|
var FileReader: typeof import('./filereader').FileReader;
|
|
68
68
|
var caches: typeof import('./cache').caches;
|
|
69
|
+
var interceptors: {
|
|
70
|
+
dump: typeof import('./interceptors').dump;
|
|
71
|
+
retry: typeof import('./interceptors').retry;
|
|
72
|
+
redirect: typeof import('./interceptors').redirect;
|
|
73
|
+
}
|
|
69
74
|
}
|
package/types/interceptors.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import Dispatcher from "./dispatcher";
|
|
2
|
+
import RetryHandler from "./retry-handler";
|
|
2
3
|
|
|
3
|
-
type
|
|
4
|
+
export type DumpInterceptorOpts = { maxSize?: number }
|
|
5
|
+
export type RetryInterceptorOpts = RetryHandler.RetryOptions
|
|
6
|
+
export type RedirectInterceptorOpts = { maxRedirections?: number }
|
|
4
7
|
|
|
5
|
-
export declare function createRedirectInterceptor (opts: RedirectInterceptorOpts): Dispatcher.
|
|
8
|
+
export declare function createRedirectInterceptor (opts: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
|
9
|
+
export declare function dump(opts?: DumpInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
|
10
|
+
export declare function retry(opts?: RetryInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
|
11
|
+
export declare function redirect(opts?: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|