undici 6.21.0 → 7.0.0-alpha.10
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 +27 -46
- package/docs/docs/api/Agent.md +14 -17
- package/docs/docs/api/BalancedPool.md +16 -16
- package/docs/docs/api/CacheStore.md +131 -0
- package/docs/docs/api/Client.md +12 -14
- package/docs/docs/api/Debug.md +1 -1
- package/docs/docs/api/Dispatcher.md +98 -194
- package/docs/docs/api/EnvHttpProxyAgent.md +12 -13
- package/docs/docs/api/MockAgent.md +5 -3
- package/docs/docs/api/MockClient.md +5 -5
- package/docs/docs/api/MockPool.md +4 -3
- package/docs/docs/api/Pool.md +15 -16
- package/docs/docs/api/PoolStats.md +1 -1
- package/docs/docs/api/ProxyAgent.md +3 -3
- package/docs/docs/api/RedirectHandler.md +1 -1
- package/docs/docs/api/RetryAgent.md +1 -1
- package/docs/docs/api/RetryHandler.md +4 -4
- package/docs/docs/api/WebSocket.md +46 -4
- package/docs/docs/api/api-lifecycle.md +11 -11
- package/docs/docs/best-practices/mocking-request.md +2 -2
- package/docs/docs/best-practices/proxy.md +1 -1
- package/index.d.ts +1 -1
- package/index.js +23 -7
- package/lib/api/abort-signal.js +2 -0
- package/lib/api/api-connect.js +3 -1
- package/lib/api/api-pipeline.js +7 -6
- package/lib/api/api-request.js +33 -48
- package/lib/api/api-stream.js +39 -50
- package/lib/api/api-upgrade.js +5 -3
- package/lib/api/readable.js +235 -62
- package/lib/api/util.js +2 -0
- package/lib/cache/memory-cache-store.js +177 -0
- package/lib/cache/sqlite-cache-store.js +446 -0
- package/lib/core/constants.js +35 -10
- package/lib/core/diagnostics.js +122 -128
- package/lib/core/errors.js +6 -6
- package/lib/core/request.js +13 -11
- package/lib/core/symbols.js +2 -1
- package/lib/core/tree.js +9 -1
- package/lib/core/util.js +237 -49
- package/lib/dispatcher/agent.js +3 -17
- package/lib/dispatcher/balanced-pool.js +5 -8
- package/lib/dispatcher/client-h1.js +379 -134
- package/lib/dispatcher/client-h2.js +173 -107
- package/lib/dispatcher/client.js +19 -32
- package/lib/dispatcher/dispatcher-base.js +6 -35
- package/lib/dispatcher/dispatcher.js +7 -24
- package/lib/dispatcher/fixed-queue.js +91 -49
- package/lib/dispatcher/pool-stats.js +2 -0
- package/lib/dispatcher/pool.js +3 -6
- package/lib/dispatcher/proxy-agent.js +3 -6
- package/lib/handler/cache-handler.js +393 -0
- package/lib/handler/cache-revalidation-handler.js +124 -0
- package/lib/handler/decorator-handler.js +27 -0
- package/lib/handler/redirect-handler.js +54 -59
- package/lib/handler/retry-handler.js +77 -109
- package/lib/handler/unwrap-handler.js +96 -0
- package/lib/handler/wrap-handler.js +98 -0
- package/lib/interceptor/cache.js +350 -0
- package/lib/interceptor/dns.js +375 -0
- package/lib/interceptor/dump.js +2 -2
- package/lib/interceptor/redirect.js +11 -14
- package/lib/interceptor/response-error.js +18 -7
- package/lib/llhttp/constants.d.ts +97 -0
- package/lib/llhttp/constants.js +412 -192
- package/lib/llhttp/constants.js.map +1 -0
- package/lib/llhttp/llhttp-wasm.js +11 -1
- package/lib/llhttp/llhttp_simd-wasm.js +11 -1
- package/lib/llhttp/utils.d.ts +2 -0
- package/lib/llhttp/utils.js +9 -9
- package/lib/llhttp/utils.js.map +1 -0
- package/lib/mock/mock-agent.js +5 -8
- package/lib/mock/mock-client.js +9 -4
- package/lib/mock/mock-errors.js +3 -1
- package/lib/mock/mock-interceptor.js +8 -6
- package/lib/mock/mock-pool.js +9 -4
- package/lib/mock/mock-symbols.js +3 -1
- package/lib/mock/mock-utils.js +29 -5
- package/lib/util/cache.js +360 -0
- package/lib/web/cache/cache.js +24 -21
- package/lib/web/cache/cachestorage.js +1 -1
- package/lib/web/cookies/index.js +29 -14
- package/lib/web/cookies/parse.js +8 -3
- package/lib/web/eventsource/eventsource-stream.js +9 -8
- package/lib/web/eventsource/eventsource.js +10 -6
- package/lib/web/fetch/body.js +43 -41
- package/lib/web/fetch/constants.js +12 -5
- package/lib/web/fetch/data-url.js +3 -3
- package/lib/web/fetch/formdata-parser.js +72 -45
- package/lib/web/fetch/formdata.js +65 -54
- package/lib/web/fetch/headers.js +118 -86
- package/lib/web/fetch/index.js +58 -67
- package/lib/web/fetch/request.js +136 -77
- package/lib/web/fetch/response.js +87 -56
- package/lib/web/fetch/util.js +259 -109
- package/lib/web/fetch/webidl.js +113 -68
- package/lib/web/websocket/connection.js +76 -147
- package/lib/web/websocket/constants.js +70 -10
- package/lib/web/websocket/events.js +4 -2
- package/lib/web/websocket/frame.js +45 -3
- package/lib/web/websocket/receiver.js +29 -33
- package/lib/web/websocket/sender.js +18 -13
- package/lib/web/websocket/stream/websocketerror.js +83 -0
- package/lib/web/websocket/stream/websocketstream.js +485 -0
- package/lib/web/websocket/util.js +128 -77
- package/lib/web/websocket/websocket.js +234 -135
- package/package.json +24 -36
- package/scripts/strip-comments.js +3 -1
- package/types/agent.d.ts +7 -7
- package/types/api.d.ts +24 -24
- package/types/balanced-pool.d.ts +11 -11
- package/types/cache-interceptor.d.ts +172 -0
- package/types/client.d.ts +11 -12
- package/types/cookies.d.ts +2 -0
- package/types/diagnostics-channel.d.ts +10 -10
- package/types/dispatcher.d.ts +113 -90
- package/types/env-http-proxy-agent.d.ts +2 -2
- package/types/errors.d.ts +53 -47
- package/types/fetch.d.ts +17 -16
- package/types/formdata.d.ts +7 -7
- package/types/global-dispatcher.d.ts +4 -4
- package/types/global-origin.d.ts +5 -5
- package/types/handlers.d.ts +7 -7
- package/types/header.d.ts +157 -1
- package/types/index.d.ts +44 -46
- package/types/interceptors.d.ts +25 -8
- package/types/mock-agent.d.ts +21 -18
- package/types/mock-client.d.ts +4 -4
- package/types/mock-errors.d.ts +3 -3
- package/types/mock-interceptor.d.ts +19 -19
- package/types/mock-pool.d.ts +4 -4
- package/types/patch.d.ts +0 -4
- package/types/pool-stats.d.ts +8 -8
- package/types/pool.d.ts +12 -12
- package/types/proxy-agent.d.ts +4 -4
- package/types/readable.d.ts +18 -15
- package/types/retry-agent.d.ts +1 -1
- package/types/retry-handler.d.ts +10 -10
- package/types/util.d.ts +3 -3
- package/types/utility.d.ts +7 -0
- package/types/webidl.d.ts +44 -6
- package/types/websocket.d.ts +34 -1
- package/docs/docs/api/DispatchInterceptor.md +0 -60
- package/lib/interceptor/redirect-interceptor.js +0 -21
- package/lib/mock/pluralizer.js +0 -29
- package/lib/web/cache/symbols.js +0 -5
- package/lib/web/fetch/file.js +0 -126
- package/lib/web/fetch/symbols.js +0 -9
- package/lib/web/fileapi/encoding.js +0 -290
- package/lib/web/fileapi/filereader.js +0 -344
- package/lib/web/fileapi/progressevent.js +0 -78
- package/lib/web/fileapi/symbols.js +0 -10
- package/lib/web/fileapi/util.js +0 -391
- package/lib/web/websocket/symbols.js +0 -12
- package/types/file.d.ts +0 -39
- package/types/filereader.d.ts +0 -54
package/types/dispatcher.d.ts
CHANGED
|
@@ -6,98 +6,96 @@ import { IncomingHttpHeaders } from './header'
|
|
|
6
6
|
import BodyReadable from './readable'
|
|
7
7
|
import { FormData } from './formdata'
|
|
8
8
|
import Errors from './errors'
|
|
9
|
+
import { Autocomplete } from './utility'
|
|
9
10
|
|
|
10
|
-
type AbortSignal = unknown
|
|
11
|
+
type AbortSignal = unknown
|
|
11
12
|
|
|
12
13
|
export default Dispatcher
|
|
13
14
|
|
|
14
15
|
/** Dispatcher is the core API used to dispatch requests. */
|
|
15
16
|
declare class Dispatcher extends EventEmitter {
|
|
16
17
|
/** Dispatches a request. This API is expected to evolve through semver-major versions and is less stable than the preceding higher level APIs. It is primarily intended for library developers who implement higher level APIs on top of this. */
|
|
17
|
-
dispatch(options: Dispatcher.DispatchOptions, handler: Dispatcher.
|
|
18
|
+
dispatch (options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean
|
|
18
19
|
/** Starts two-way communications with the requested resource. */
|
|
19
|
-
connect(options: Dispatcher.ConnectOptions): Promise<Dispatcher.ConnectData
|
|
20
|
-
connect(options: Dispatcher.ConnectOptions
|
|
20
|
+
connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>): Promise<Dispatcher.ConnectData<TOpaque>>
|
|
21
|
+
connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ConnectData<TOpaque>) => void): void
|
|
21
22
|
/** Compose a chain of dispatchers */
|
|
22
|
-
compose(dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher
|
|
23
|
-
compose(...dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher
|
|
23
|
+
compose (dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher
|
|
24
|
+
compose (...dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher
|
|
24
25
|
/** Performs an HTTP request. */
|
|
25
|
-
request(options: Dispatcher.RequestOptions): Promise<Dispatcher.ResponseData
|
|
26
|
-
request(options: Dispatcher.RequestOptions
|
|
26
|
+
request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>): Promise<Dispatcher.ResponseData<TOpaque>>
|
|
27
|
+
request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ResponseData<TOpaque>) => void): void
|
|
27
28
|
/** For easy use with `stream.pipeline`. */
|
|
28
|
-
pipeline(options: Dispatcher.PipelineOptions
|
|
29
|
+
pipeline<TOpaque = null>(options: Dispatcher.PipelineOptions<TOpaque>, handler: Dispatcher.PipelineHandler<TOpaque>): Duplex
|
|
29
30
|
/** A faster version of `Dispatcher.request`. */
|
|
30
|
-
stream(options: Dispatcher.RequestOptions
|
|
31
|
-
stream(options: Dispatcher.RequestOptions
|
|
31
|
+
stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>): Promise<Dispatcher.StreamData<TOpaque>>
|
|
32
|
+
stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>, callback: (err: Error | null, data: Dispatcher.StreamData<TOpaque>) => void): void
|
|
32
33
|
/** Upgrade to a different protocol. */
|
|
33
|
-
upgrade(options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData
|
|
34
|
-
upgrade(options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void
|
|
34
|
+
upgrade (options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>
|
|
35
|
+
upgrade (options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void
|
|
35
36
|
/** Closes the client and gracefully waits for enqueued requests to complete before invoking the callback (or returning a promise if no callback is provided). */
|
|
36
|
-
close(): Promise<void
|
|
37
|
-
close(callback: () => void): void
|
|
37
|
+
close (): Promise<void>
|
|
38
|
+
close (callback: () => void): void
|
|
38
39
|
/** Destroy the client abruptly with the given err. All the pending and running requests will be asynchronously aborted and error. Waits until socket is closed before invoking the callback (or returning a promise if no callback is provided). Since this operation is asynchronously dispatched there might still be some progress on dispatched requests. */
|
|
39
|
-
destroy(): Promise<void
|
|
40
|
-
destroy(err: Error | null): Promise<void
|
|
41
|
-
destroy(callback: () => void): void
|
|
42
|
-
destroy(err: Error | null, callback: () => void): void
|
|
40
|
+
destroy (): Promise<void>
|
|
41
|
+
destroy (err: Error | null): Promise<void>
|
|
42
|
+
destroy (callback: () => void): void
|
|
43
|
+
destroy (err: Error | null, callback: () => void): void
|
|
43
44
|
|
|
44
|
-
on(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
|
|
45
|
-
on(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
|
|
46
|
-
on(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
|
|
47
|
-
on(eventName: 'drain', callback: (origin: URL) => void): this
|
|
45
|
+
on (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
|
|
46
|
+
on (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
|
|
47
|
+
on (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
|
|
48
|
+
on (eventName: 'drain', callback: (origin: URL) => void): this
|
|
48
49
|
|
|
50
|
+
once (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
|
|
51
|
+
once (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
|
|
52
|
+
once (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
|
|
53
|
+
once (eventName: 'drain', callback: (origin: URL) => void): this
|
|
49
54
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
off (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
|
|
56
|
+
off (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
|
|
57
|
+
off (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
|
|
58
|
+
off (eventName: 'drain', callback: (origin: URL) => void): this
|
|
54
59
|
|
|
60
|
+
addListener (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
|
|
61
|
+
addListener (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
|
|
62
|
+
addListener (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
|
|
63
|
+
addListener (eventName: 'drain', callback: (origin: URL) => void): this
|
|
55
64
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
65
|
+
removeListener (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
|
|
66
|
+
removeListener (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
|
|
67
|
+
removeListener (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
|
|
68
|
+
removeListener (eventName: 'drain', callback: (origin: URL) => void): this
|
|
60
69
|
|
|
70
|
+
prependListener (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
|
|
71
|
+
prependListener (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
|
|
72
|
+
prependListener (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
|
|
73
|
+
prependListener (eventName: 'drain', callback: (origin: URL) => void): this
|
|
61
74
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
75
|
+
prependOnceListener (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
|
|
76
|
+
prependOnceListener (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
|
|
77
|
+
prependOnceListener (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
|
|
78
|
+
prependOnceListener (eventName: 'drain', callback: (origin: URL) => void): this
|
|
66
79
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
80
|
+
listeners (eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[]
|
|
81
|
+
listeners (eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]
|
|
82
|
+
listeners (eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]
|
|
83
|
+
listeners (eventName: 'drain'): ((origin: URL) => void)[]
|
|
71
84
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
rawListeners (eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[]
|
|
86
|
+
rawListeners (eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]
|
|
87
|
+
rawListeners (eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]
|
|
88
|
+
rawListeners (eventName: 'drain'): ((origin: URL) => void)[]
|
|
76
89
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
listeners(eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[]
|
|
83
|
-
listeners(eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
84
|
-
listeners(eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
85
|
-
listeners(eventName: 'drain'): ((origin: URL) => void)[];
|
|
86
|
-
|
|
87
|
-
rawListeners(eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[]
|
|
88
|
-
rawListeners(eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
89
|
-
rawListeners(eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
90
|
-
rawListeners(eventName: 'drain'): ((origin: URL) => void)[];
|
|
91
|
-
|
|
92
|
-
emit(eventName: 'connect', origin: URL, targets: readonly Dispatcher[]): boolean;
|
|
93
|
-
emit(eventName: 'disconnect', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
|
|
94
|
-
emit(eventName: 'connectionError', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
|
|
95
|
-
emit(eventName: 'drain', origin: URL): boolean;
|
|
90
|
+
emit (eventName: 'connect', origin: URL, targets: readonly Dispatcher[]): boolean
|
|
91
|
+
emit (eventName: 'disconnect', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean
|
|
92
|
+
emit (eventName: 'connectionError', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean
|
|
93
|
+
emit (eventName: 'drain', origin: URL): boolean
|
|
96
94
|
}
|
|
97
95
|
|
|
98
96
|
declare namespace Dispatcher {
|
|
99
97
|
export interface ComposedDispatcher extends Dispatcher {}
|
|
100
|
-
export type DispatcherComposeInterceptor = (dispatch: Dispatcher['dispatch']) => Dispatcher['dispatch']
|
|
98
|
+
export type DispatcherComposeInterceptor = (dispatch: Dispatcher['dispatch']) => Dispatcher['dispatch']
|
|
101
99
|
export interface DispatchOptions {
|
|
102
100
|
origin?: string | URL;
|
|
103
101
|
path: string;
|
|
@@ -105,12 +103,12 @@ declare namespace Dispatcher {
|
|
|
105
103
|
/** Default: `null` */
|
|
106
104
|
body?: string | Buffer | Uint8Array | Readable | null | FormData;
|
|
107
105
|
/** Default: `null` */
|
|
108
|
-
headers?: IncomingHttpHeaders | string[] | Iterable<[string, string | string[] | undefined]> | null;
|
|
106
|
+
headers?: Record<string, string | string[]> | IncomingHttpHeaders | string[] | Iterable<[string, string | string[] | undefined]> | null;
|
|
109
107
|
/** Query string params to be embedded in the request URL. Default: `null` */
|
|
110
108
|
query?: Record<string, any>;
|
|
111
109
|
/** Whether the requests can be safely retried or not. If `false` the request won't be sent until all preceding requests in the pipeline have completed. Default: `true` if `method` is `HEAD` or `GET`. */
|
|
112
110
|
idempotent?: boolean;
|
|
113
|
-
/** Whether the response is expected to take a long time and would end up blocking the pipeline. When this is set to `true` further pipelining will be avoided on the same connection until headers have been received. */
|
|
111
|
+
/** Whether the response is expected to take a long time and would end up blocking the pipeline. When this is set to `true` further pipelining will be avoided on the same connection until headers have been received. Defaults to `method !== 'HEAD'`. */
|
|
114
112
|
blocking?: boolean;
|
|
115
113
|
/** Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`. Default: `method === 'CONNECT' || null`. */
|
|
116
114
|
upgrade?: boolean | string | null;
|
|
@@ -122,10 +120,10 @@ declare namespace Dispatcher {
|
|
|
122
120
|
reset?: boolean;
|
|
123
121
|
/** Whether Undici should throw an error upon receiving a 4xx or 5xx response from the server. Defaults to false */
|
|
124
122
|
throwOnError?: boolean;
|
|
125
|
-
/** For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server*/
|
|
123
|
+
/** For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server */
|
|
126
124
|
expectContinue?: boolean;
|
|
127
125
|
}
|
|
128
|
-
export interface ConnectOptions {
|
|
126
|
+
export interface ConnectOptions<TOpaque = null> {
|
|
129
127
|
origin: string | URL;
|
|
130
128
|
path: string;
|
|
131
129
|
/** Default: `null` */
|
|
@@ -133,17 +131,17 @@ declare namespace Dispatcher {
|
|
|
133
131
|
/** Default: `null` */
|
|
134
132
|
signal?: AbortSignal | EventEmitter | null;
|
|
135
133
|
/** This argument parameter is passed through to `ConnectData` */
|
|
136
|
-
opaque?:
|
|
134
|
+
opaque?: TOpaque;
|
|
137
135
|
/** Default: 0 */
|
|
138
136
|
maxRedirections?: number;
|
|
139
137
|
/** Default: false */
|
|
140
138
|
redirectionLimitReached?: boolean;
|
|
141
139
|
/** Default: `null` */
|
|
142
|
-
|
|
140
|
+
responseHeaders?: 'raw' | null;
|
|
143
141
|
}
|
|
144
|
-
export interface RequestOptions extends DispatchOptions {
|
|
142
|
+
export interface RequestOptions<TOpaque = null> extends DispatchOptions {
|
|
145
143
|
/** Default: `null` */
|
|
146
|
-
opaque?:
|
|
144
|
+
opaque?: TOpaque;
|
|
147
145
|
/** Default: `null` */
|
|
148
146
|
signal?: AbortSignal | EventEmitter | null;
|
|
149
147
|
/** Default: 0 */
|
|
@@ -153,11 +151,11 @@ declare namespace Dispatcher {
|
|
|
153
151
|
/** Default: `null` */
|
|
154
152
|
onInfo?: (info: { statusCode: number, headers: Record<string, string | string[]> }) => void;
|
|
155
153
|
/** Default: `null` */
|
|
156
|
-
|
|
154
|
+
responseHeaders?: 'raw' | null;
|
|
157
155
|
/** Default: `64 KiB` */
|
|
158
156
|
highWaterMark?: number;
|
|
159
157
|
}
|
|
160
|
-
export interface PipelineOptions extends RequestOptions {
|
|
158
|
+
export interface PipelineOptions<TOpaque = null> extends RequestOptions<TOpaque> {
|
|
161
159
|
/** `true` if the `handler` will return an object stream. Default: `false` */
|
|
162
160
|
objectMode?: boolean;
|
|
163
161
|
}
|
|
@@ -176,65 +174,90 @@ declare namespace Dispatcher {
|
|
|
176
174
|
/** Default: false */
|
|
177
175
|
redirectionLimitReached?: boolean;
|
|
178
176
|
/** Default: `null` */
|
|
179
|
-
|
|
177
|
+
responseHeaders?: 'raw' | null;
|
|
180
178
|
}
|
|
181
|
-
export interface ConnectData {
|
|
179
|
+
export interface ConnectData<TOpaque = null> {
|
|
182
180
|
statusCode: number;
|
|
183
181
|
headers: IncomingHttpHeaders;
|
|
184
182
|
socket: Duplex;
|
|
185
|
-
opaque:
|
|
183
|
+
opaque: TOpaque;
|
|
186
184
|
}
|
|
187
|
-
export interface ResponseData {
|
|
185
|
+
export interface ResponseData<TOpaque = null> {
|
|
188
186
|
statusCode: number;
|
|
189
187
|
headers: IncomingHttpHeaders;
|
|
190
188
|
body: BodyReadable & BodyMixin;
|
|
191
189
|
trailers: Record<string, string>;
|
|
192
|
-
opaque:
|
|
190
|
+
opaque: TOpaque;
|
|
193
191
|
context: object;
|
|
194
192
|
}
|
|
195
|
-
export interface PipelineHandlerData {
|
|
193
|
+
export interface PipelineHandlerData<TOpaque = null> {
|
|
196
194
|
statusCode: number;
|
|
197
195
|
headers: IncomingHttpHeaders;
|
|
198
|
-
opaque:
|
|
196
|
+
opaque: TOpaque;
|
|
199
197
|
body: BodyReadable;
|
|
200
198
|
context: object;
|
|
201
199
|
}
|
|
202
|
-
export interface StreamData {
|
|
203
|
-
opaque:
|
|
200
|
+
export interface StreamData<TOpaque = null> {
|
|
201
|
+
opaque: TOpaque;
|
|
204
202
|
trailers: Record<string, string>;
|
|
205
203
|
}
|
|
206
|
-
export interface UpgradeData {
|
|
204
|
+
export interface UpgradeData<TOpaque = null> {
|
|
207
205
|
headers: IncomingHttpHeaders;
|
|
208
206
|
socket: Duplex;
|
|
209
|
-
opaque:
|
|
207
|
+
opaque: TOpaque;
|
|
210
208
|
}
|
|
211
|
-
export interface StreamFactoryData {
|
|
209
|
+
export interface StreamFactoryData<TOpaque = null> {
|
|
212
210
|
statusCode: number;
|
|
213
211
|
headers: IncomingHttpHeaders;
|
|
214
|
-
opaque:
|
|
212
|
+
opaque: TOpaque;
|
|
215
213
|
context: object;
|
|
216
214
|
}
|
|
217
|
-
export type StreamFactory = (data: StreamFactoryData) => Writable
|
|
218
|
-
|
|
215
|
+
export type StreamFactory<TOpaque = null> = (data: StreamFactoryData<TOpaque>) => Writable
|
|
216
|
+
|
|
217
|
+
export interface DispatchController {
|
|
218
|
+
get aborted () : boolean
|
|
219
|
+
get paused () : boolean
|
|
220
|
+
get reason () : Error | null
|
|
221
|
+
abort (reason: Error): void
|
|
222
|
+
pause(): void
|
|
223
|
+
resume(): void
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export interface DispatchHandler {
|
|
227
|
+
onRequestStart?(controller: DispatchController, context: any): void;
|
|
228
|
+
onRequestUpgrade?(controller: DispatchController, statusCode: number, headers: IncomingHttpHeaders, socket: Duplex): void;
|
|
229
|
+
onResponseStart?(controller: DispatchController, statusCode: number, headers: IncomingHttpHeaders, statusMessage?: string): void;
|
|
230
|
+
onResponseData?(controller: DispatchController, chunk: Buffer): void;
|
|
231
|
+
onResponseEnd?(controller: DispatchController, trailers: IncomingHttpHeaders): void;
|
|
232
|
+
onResponseError?(controller: DispatchController, error: Error): void;
|
|
233
|
+
|
|
219
234
|
/** Invoked before request is dispatched on socket. May be invoked multiple times when a request is retried when the request at the head of the pipeline fails. */
|
|
235
|
+
/** @deprecated */
|
|
220
236
|
onConnect?(abort: (err?: Error) => void): void;
|
|
221
237
|
/** Invoked when an error has occurred. */
|
|
238
|
+
/** @deprecated */
|
|
222
239
|
onError?(err: Error): void;
|
|
223
240
|
/** Invoked when request is upgraded either due to a `Upgrade` header or `CONNECT` method. */
|
|
241
|
+
/** @deprecated */
|
|
224
242
|
onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex): void;
|
|
225
243
|
/** Invoked when response is received, before headers have been read. **/
|
|
244
|
+
/** @deprecated */
|
|
226
245
|
onResponseStarted?(): void;
|
|
227
246
|
/** Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. */
|
|
247
|
+
/** @deprecated */
|
|
228
248
|
onHeaders?(statusCode: number, headers: Buffer[], resume: () => void, statusText: string): boolean;
|
|
229
249
|
/** Invoked when response payload data is received. */
|
|
250
|
+
/** @deprecated */
|
|
230
251
|
onData?(chunk: Buffer): boolean;
|
|
231
252
|
/** Invoked when response payload and trailers have been received and the request has completed. */
|
|
253
|
+
/** @deprecated */
|
|
232
254
|
onComplete?(trailers: string[] | null): void;
|
|
233
255
|
/** Invoked when a body chunk is sent to the server. May be invoked multiple times for chunked requests */
|
|
256
|
+
/** @deprecated */
|
|
234
257
|
onBodySent?(chunkSize: number, totalBytesSent: number): void;
|
|
235
258
|
}
|
|
236
|
-
export type PipelineHandler = (data: PipelineHandlerData) => Readable
|
|
237
|
-
export type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'
|
|
259
|
+
export type PipelineHandler<TOpaque = null> = (data: PipelineHandlerData<TOpaque>) => Readable
|
|
260
|
+
export type HttpMethod = Autocomplete<'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'>
|
|
238
261
|
|
|
239
262
|
/**
|
|
240
263
|
* @link https://fetch.spec.whatwg.org/#body-mixin
|
|
@@ -4,9 +4,9 @@ import Dispatcher from './dispatcher'
|
|
|
4
4
|
export default EnvHttpProxyAgent
|
|
5
5
|
|
|
6
6
|
declare class EnvHttpProxyAgent extends Dispatcher {
|
|
7
|
-
constructor(opts?: EnvHttpProxyAgent.Options)
|
|
7
|
+
constructor (opts?: EnvHttpProxyAgent.Options)
|
|
8
8
|
|
|
9
|
-
dispatch(options: Agent.DispatchOptions, handler: Dispatcher.
|
|
9
|
+
dispatch (options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
declare namespace EnvHttpProxyAgent {
|
package/types/errors.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { IncomingHttpHeaders } from
|
|
1
|
+
import { IncomingHttpHeaders } from './header'
|
|
2
2
|
import Client from './client'
|
|
3
3
|
|
|
4
4
|
export default Errors
|
|
5
5
|
|
|
6
6
|
declare namespace Errors {
|
|
7
7
|
export class UndiciError extends Error {
|
|
8
|
-
name: string
|
|
9
|
-
code: string
|
|
8
|
+
name: string
|
|
9
|
+
code: string
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
/** Connect timeout error. */
|
|
13
13
|
export class ConnectTimeoutError extends UndiciError {
|
|
14
|
-
name: 'ConnectTimeoutError'
|
|
15
|
-
code: 'UND_ERR_CONNECT_TIMEOUT'
|
|
14
|
+
name: 'ConnectTimeoutError'
|
|
15
|
+
code: 'UND_ERR_CONNECT_TIMEOUT'
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/** A header exceeds the `headersTimeout` option. */
|
|
19
19
|
export class HeadersTimeoutError extends UndiciError {
|
|
20
|
-
name: 'HeadersTimeoutError'
|
|
21
|
-
code: 'UND_ERR_HEADERS_TIMEOUT'
|
|
20
|
+
name: 'HeadersTimeoutError'
|
|
21
|
+
code: 'UND_ERR_HEADERS_TIMEOUT'
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/** Headers overflow error. */
|
|
@@ -29,8 +29,8 @@ declare namespace Errors {
|
|
|
29
29
|
|
|
30
30
|
/** A body exceeds the `bodyTimeout` option. */
|
|
31
31
|
export class BodyTimeoutError extends UndiciError {
|
|
32
|
-
name: 'BodyTimeoutError'
|
|
33
|
-
code: 'UND_ERR_BODY_TIMEOUT'
|
|
32
|
+
name: 'BodyTimeoutError'
|
|
33
|
+
code: 'UND_ERR_BODY_TIMEOUT'
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export class ResponseStatusCodeError extends UndiciError {
|
|
@@ -39,91 +39,91 @@ declare namespace Errors {
|
|
|
39
39
|
statusCode?: number,
|
|
40
40
|
headers?: IncomingHttpHeaders | string[] | null,
|
|
41
41
|
body?: null | Record<string, any> | string
|
|
42
|
-
)
|
|
43
|
-
name: 'ResponseStatusCodeError'
|
|
44
|
-
code: 'UND_ERR_RESPONSE_STATUS_CODE'
|
|
42
|
+
)
|
|
43
|
+
name: 'ResponseStatusCodeError'
|
|
44
|
+
code: 'UND_ERR_RESPONSE_STATUS_CODE'
|
|
45
45
|
body: null | Record<string, any> | string
|
|
46
46
|
status: number
|
|
47
47
|
statusCode: number
|
|
48
|
-
headers: IncomingHttpHeaders | string[] | null
|
|
48
|
+
headers: IncomingHttpHeaders | string[] | null
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/** Passed an invalid argument. */
|
|
52
52
|
export class InvalidArgumentError extends UndiciError {
|
|
53
|
-
name: 'InvalidArgumentError'
|
|
54
|
-
code: 'UND_ERR_INVALID_ARG'
|
|
53
|
+
name: 'InvalidArgumentError'
|
|
54
|
+
code: 'UND_ERR_INVALID_ARG'
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/** Returned an invalid value. */
|
|
58
58
|
export class InvalidReturnValueError extends UndiciError {
|
|
59
|
-
name: 'InvalidReturnValueError'
|
|
60
|
-
code: 'UND_ERR_INVALID_RETURN_VALUE'
|
|
59
|
+
name: 'InvalidReturnValueError'
|
|
60
|
+
code: 'UND_ERR_INVALID_RETURN_VALUE'
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/** The request has been aborted by the user. */
|
|
64
64
|
export class RequestAbortedError extends UndiciError {
|
|
65
|
-
name: 'AbortError'
|
|
66
|
-
code: 'UND_ERR_ABORTED'
|
|
65
|
+
name: 'AbortError'
|
|
66
|
+
code: 'UND_ERR_ABORTED'
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/** Expected error with reason. */
|
|
70
70
|
export class InformationalError extends UndiciError {
|
|
71
|
-
name: 'InformationalError'
|
|
72
|
-
code: 'UND_ERR_INFO'
|
|
71
|
+
name: 'InformationalError'
|
|
72
|
+
code: 'UND_ERR_INFO'
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/** Request body length does not match content-length header. */
|
|
76
76
|
export class RequestContentLengthMismatchError extends UndiciError {
|
|
77
|
-
name: 'RequestContentLengthMismatchError'
|
|
78
|
-
code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH'
|
|
77
|
+
name: 'RequestContentLengthMismatchError'
|
|
78
|
+
code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH'
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
/** Response body length does not match content-length header. */
|
|
82
82
|
export class ResponseContentLengthMismatchError extends UndiciError {
|
|
83
|
-
name: 'ResponseContentLengthMismatchError'
|
|
84
|
-
code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH'
|
|
83
|
+
name: 'ResponseContentLengthMismatchError'
|
|
84
|
+
code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH'
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/** Trying to use a destroyed client. */
|
|
88
88
|
export class ClientDestroyedError extends UndiciError {
|
|
89
|
-
name: 'ClientDestroyedError'
|
|
90
|
-
code: 'UND_ERR_DESTROYED'
|
|
89
|
+
name: 'ClientDestroyedError'
|
|
90
|
+
code: 'UND_ERR_DESTROYED'
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/** Trying to use a closed client. */
|
|
94
94
|
export class ClientClosedError extends UndiciError {
|
|
95
|
-
name: 'ClientClosedError'
|
|
96
|
-
code: 'UND_ERR_CLOSED'
|
|
95
|
+
name: 'ClientClosedError'
|
|
96
|
+
code: 'UND_ERR_CLOSED'
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
/** There is an error with the socket. */
|
|
100
100
|
export class SocketError extends UndiciError {
|
|
101
|
-
name: 'SocketError'
|
|
102
|
-
code: 'UND_ERR_SOCKET'
|
|
101
|
+
name: 'SocketError'
|
|
102
|
+
code: 'UND_ERR_SOCKET'
|
|
103
103
|
socket: Client.SocketInfo | null
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
/** Encountered unsupported functionality. */
|
|
107
107
|
export class NotSupportedError extends UndiciError {
|
|
108
|
-
name: 'NotSupportedError'
|
|
109
|
-
code: 'UND_ERR_NOT_SUPPORTED'
|
|
108
|
+
name: 'NotSupportedError'
|
|
109
|
+
code: 'UND_ERR_NOT_SUPPORTED'
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/** No upstream has been added to the BalancedPool. */
|
|
113
113
|
export class BalancedPoolMissingUpstreamError extends UndiciError {
|
|
114
|
-
name: 'MissingUpstreamError'
|
|
115
|
-
code: 'UND_ERR_BPL_MISSING_UPSTREAM'
|
|
114
|
+
name: 'MissingUpstreamError'
|
|
115
|
+
code: 'UND_ERR_BPL_MISSING_UPSTREAM'
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
export class HTTPParserError extends UndiciError {
|
|
119
|
-
name: 'HTTPParserError'
|
|
120
|
-
code: string
|
|
119
|
+
name: 'HTTPParserError'
|
|
120
|
+
code: string
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
/** The response exceed the length allowed. */
|
|
124
124
|
export class ResponseExceededMaxSizeError extends UndiciError {
|
|
125
|
-
name: 'ResponseExceededMaxSizeError'
|
|
126
|
-
code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE'
|
|
125
|
+
name: 'ResponseExceededMaxSizeError'
|
|
126
|
+
code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE'
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
export class RequestRetryError extends UndiciError {
|
|
@@ -132,18 +132,24 @@ declare namespace Errors {
|
|
|
132
132
|
statusCode: number,
|
|
133
133
|
headers?: IncomingHttpHeaders | string[] | null,
|
|
134
134
|
body?: null | Record<string, any> | string
|
|
135
|
-
)
|
|
136
|
-
name: 'RequestRetryError'
|
|
137
|
-
code: 'UND_ERR_REQ_RETRY'
|
|
138
|
-
statusCode: number
|
|
135
|
+
)
|
|
136
|
+
name: 'RequestRetryError'
|
|
137
|
+
code: 'UND_ERR_REQ_RETRY'
|
|
138
|
+
statusCode: number
|
|
139
139
|
data: {
|
|
140
140
|
count: number;
|
|
141
|
-
}
|
|
142
|
-
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
headers: Record<string, string | string[]>
|
|
143
144
|
}
|
|
144
145
|
|
|
145
146
|
export class SecureProxyConnectionError extends UndiciError {
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
constructor (
|
|
148
|
+
cause?: Error,
|
|
149
|
+
message?: string,
|
|
150
|
+
options?: Record<any, any>
|
|
151
|
+
)
|
|
152
|
+
name: 'SecureProxyConnectionError'
|
|
153
|
+
code: 'UND_ERR_PRX_TLS'
|
|
148
154
|
}
|
|
149
155
|
}
|
package/types/fetch.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { Blob } from 'buffer'
|
|
|
6
6
|
import { URL, URLSearchParams } from 'url'
|
|
7
7
|
import { ReadableStream } from 'stream/web'
|
|
8
8
|
import { FormData } from './formdata'
|
|
9
|
-
|
|
9
|
+
import { HeaderRecord } from './header'
|
|
10
10
|
import Dispatcher from './dispatcher'
|
|
11
11
|
|
|
12
12
|
export type RequestInfo = string | URL | Request
|
|
@@ -36,17 +36,17 @@ export class BodyMixin {
|
|
|
36
36
|
/**
|
|
37
37
|
* @deprecated This method is not recommended for parsing multipart/form-data bodies in server environments.
|
|
38
38
|
* It is recommended to use a library such as [@fastify/busboy](https://www.npmjs.com/package/@fastify/busboy) as follows:
|
|
39
|
-
*
|
|
39
|
+
*
|
|
40
40
|
* @example
|
|
41
41
|
* ```js
|
|
42
42
|
* import { Busboy } from '@fastify/busboy'
|
|
43
43
|
* import { Readable } from 'node:stream'
|
|
44
|
-
*
|
|
44
|
+
*
|
|
45
45
|
* const response = await fetch('...')
|
|
46
46
|
* const busboy = new Busboy({ headers: { 'content-type': response.headers.get('content-type') } })
|
|
47
|
-
*
|
|
47
|
+
*
|
|
48
48
|
* // handle events emitted from `busboy`
|
|
49
|
-
*
|
|
49
|
+
*
|
|
50
50
|
* Readable.fromWeb(response.body).pipe(busboy)
|
|
51
51
|
* ```
|
|
52
52
|
*/
|
|
@@ -67,7 +67,7 @@ export interface SpecIterable<T> {
|
|
|
67
67
|
[Symbol.iterator](): SpecIterator<T>;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
export type HeadersInit =
|
|
70
|
+
export type HeadersInit = [string, string][] | HeaderRecord | Headers
|
|
71
71
|
|
|
72
72
|
export declare class Headers implements SpecIterable<[string, string]> {
|
|
73
73
|
constructor (init?: HeadersInit)
|
|
@@ -119,20 +119,21 @@ type RequestDestination =
|
|
|
119
119
|
| 'xslt'
|
|
120
120
|
|
|
121
121
|
export interface RequestInit {
|
|
122
|
-
method?: string
|
|
123
|
-
keepalive?: boolean
|
|
124
|
-
headers?: HeadersInit
|
|
125
122
|
body?: BodyInit | null
|
|
126
|
-
|
|
127
|
-
integrity?: string
|
|
128
|
-
signal?: AbortSignal | null
|
|
123
|
+
cache?: RequestCache
|
|
129
124
|
credentials?: RequestCredentials
|
|
125
|
+
dispatcher?: Dispatcher
|
|
126
|
+
duplex?: RequestDuplex
|
|
127
|
+
headers?: HeadersInit
|
|
128
|
+
integrity?: string
|
|
129
|
+
keepalive?: boolean
|
|
130
|
+
method?: string
|
|
130
131
|
mode?: RequestMode
|
|
132
|
+
redirect?: RequestRedirect
|
|
131
133
|
referrer?: string
|
|
132
134
|
referrerPolicy?: ReferrerPolicy
|
|
135
|
+
signal?: AbortSignal | null
|
|
133
136
|
window?: null
|
|
134
|
-
dispatcher?: Dispatcher
|
|
135
|
-
duplex?: RequestDuplex
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
export type ReferrerPolicy =
|
|
@@ -144,7 +145,7 @@ export type ReferrerPolicy =
|
|
|
144
145
|
| 'same-origin'
|
|
145
146
|
| 'strict-origin'
|
|
146
147
|
| 'strict-origin-when-cross-origin'
|
|
147
|
-
| 'unsafe-url'
|
|
148
|
+
| 'unsafe-url'
|
|
148
149
|
|
|
149
150
|
export type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin'
|
|
150
151
|
|
|
@@ -204,6 +205,6 @@ export declare class Response extends BodyMixin {
|
|
|
204
205
|
readonly clone: () => Response
|
|
205
206
|
|
|
206
207
|
static error (): Response
|
|
207
|
-
static json(data: any, init?: ResponseInit): Response
|
|
208
|
+
static json (data: any, init?: ResponseInit): Response
|
|
208
209
|
static redirect (url: string | URL, status: ResponseRedirectStatus): Response
|
|
209
210
|
}
|