undici 8.12.2 → 8.12.4

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.
@@ -14,7 +14,8 @@ const {
14
14
  normalizeHeaders,
15
15
  parseCacheControlHeader,
16
16
  isInvalidOrWildcardVaryHeader,
17
- parseVaryHeader
17
+ parseVaryHeader,
18
+ isEtagUsable
18
19
  } = require('../util/cache.js')
19
20
  const { AbortError } = require('../core/errors.js')
20
21
  const { parseHttpDate } = require('../util/date.js')
@@ -202,6 +203,47 @@ function makeRevalidationHeaders (opts, result) {
202
203
  return headers
203
204
  }
204
205
 
206
+ function revalidationTargetMatchesCacheKey (cacheKey, context) {
207
+ const history = context?.history
208
+ if (!Array.isArray(history) || history.length === 0) {
209
+ return true
210
+ }
211
+
212
+ try {
213
+ const cachedUrl = new URL(cacheKey.path, cacheKey.origin)
214
+ const responseUrl = history[history.length - 1]
215
+ return responseUrl.origin === cachedUrl.origin &&
216
+ responseUrl.pathname === cachedUrl.pathname &&
217
+ responseUrl.search === cachedUrl.search
218
+ } catch {
219
+ return false
220
+ }
221
+ }
222
+
223
+ function revalidationEtagMatchesCachedValue (result, headers) {
224
+ if (!Object.hasOwn(headers, 'etag')) {
225
+ return true
226
+ }
227
+
228
+ const responseEtag = headers.etag
229
+ const cachedEtag = result.etag
230
+ if (
231
+ typeof responseEtag !== 'string' ||
232
+ typeof cachedEtag !== 'string' ||
233
+ !isEtagUsable(responseEtag) ||
234
+ !isEtagUsable(cachedEtag)
235
+ ) {
236
+ return false
237
+ }
238
+
239
+ if (!responseEtag.startsWith('W/')) {
240
+ return responseEtag === cachedEtag
241
+ }
242
+
243
+ const cachedOpaqueTag = cachedEtag.startsWith('W/') ? cachedEtag.slice(2) : cachedEtag
244
+ return responseEtag.slice(2) === cachedOpaqueTag
245
+ }
246
+
205
247
  /**
206
248
  * @param {import('../../types/cache-interceptor.d.ts').default.GetResult} result
207
249
  * @param {import('../../types/cache-interceptor.d.ts').default.CacheControlDirectives | undefined} cacheControlDirectives
@@ -366,21 +408,35 @@ function sendCachedValue (handler, opts, result, age, context, isStale) {
366
408
 
367
409
  stream
368
410
  .on('error', function (err) {
411
+ // Never rethrow: this runs from a stream event on a later tick, where a
412
+ // throw would crash the process. Like core's Request.onResponseError,
413
+ // the error is dropped if the handler has no onResponseError.
369
414
  if (!this.readableEnded) {
370
- if (typeof handler.onResponseError === 'function') {
371
- handler.onResponseError(controller, err)
372
- } else {
373
- throw err
374
- }
415
+ handler.onResponseError?.(controller, err)
375
416
  }
376
417
  })
377
418
  .on('close', function () {
378
419
  if (!this.errored) {
379
- handler.onResponseEnd?.(controller, {})
420
+ try {
421
+ handler.onResponseEnd?.(controller, {})
422
+ } catch (err) {
423
+ // The stream is already closed, so the error can't be routed
424
+ // through it; report it to the handler directly instead.
425
+ handler.onResponseError?.(controller, err)
426
+ }
380
427
  }
381
428
  })
382
429
 
383
- handler.onRequestStart?.(controller, context)
430
+ // Downstream handler calls below run outside the dispatcher's own error
431
+ // handling (on later ticks for the body, or inside a promise callback for
432
+ // async stores), so a throw must be converged to a per-request error
433
+ // instead of escaping as an uncaught exception.
434
+ try {
435
+ handler.onRequestStart?.(controller, context)
436
+ } catch (err) {
437
+ stream.destroy(err)
438
+ return
439
+ }
384
440
 
385
441
  if (stream.destroyed) {
386
442
  return
@@ -398,13 +454,22 @@ function sendCachedValue (handler, opts, result, age, context, isStale) {
398
454
 
399
455
  controller.rawHeaders = util.toRawHeaders(headers)
400
456
 
401
- handler.onResponseStart?.(controller, result.statusCode, headers, result.statusMessage)
457
+ try {
458
+ handler.onResponseStart?.(controller, result.statusCode, headers, result.statusMessage)
459
+ } catch (err) {
460
+ stream.destroy(err)
461
+ return
462
+ }
402
463
 
403
464
  if (opts.method === 'HEAD') {
404
465
  stream.destroy()
405
466
  } else {
406
467
  stream.on('data', function (chunk) {
407
- handler.onResponseData?.(controller, chunk)
468
+ try {
469
+ handler.onResponseData?.(controller, chunk)
470
+ } catch (err) {
471
+ stream.destroy(err)
472
+ }
408
473
  })
409
474
  }
410
475
  }
@@ -502,6 +567,14 @@ function handleResult (
502
567
  }
503
568
 
504
569
  const headers = makeRevalidationHeaders(opts, result)
570
+ const refetch = () => {
571
+ if (util.isStream(result.body)) {
572
+ result.body.on('error', nop).destroy()
573
+ }
574
+
575
+ deleteCachedValue(globalOpts.store, cacheKey)
576
+ return dispatch(opts, new CacheHandler(globalOpts, cacheKey, handler))
577
+ }
505
578
 
506
579
  // We need to revalidate the response
507
580
  return dispatch(
@@ -513,24 +586,18 @@ function handleResult (
513
586
  (success, context, statusCode, headers) => {
514
587
  if (success) {
515
588
  if (statusCode === 304) {
516
- if (revalidationResponseDisallowsCachedReuse(globalOpts.type, headers)) {
517
- if (util.isStream(result.body)) {
518
- result.body.on('error', nop).destroy()
519
- }
520
-
521
- deleteCachedValue(globalOpts.store, cacheKey)
522
- return dispatch(opts, new CacheHandler(globalOpts, cacheKey, handler))
589
+ if (
590
+ !revalidationTargetMatchesCacheKey(cacheKey, context) ||
591
+ !revalidationEtagMatchesCachedValue(result, headers) ||
592
+ revalidationResponseDisallowsCachedReuse(globalOpts.type, headers)
593
+ ) {
594
+ return refetch()
523
595
  }
524
596
 
525
597
  if (revalidationResponseUpdatesCacheControl(headers)) {
526
598
  deleteCachedValue(globalOpts.store, cacheKey)
527
599
  } else if (revalidationResponseAddsVary(result, headers.vary ? parseVaryHeader(headers.vary, opts.headers) : undefined)) {
528
- if (util.isStream(result.body)) {
529
- result.body.on('error', nop).destroy()
530
- }
531
-
532
- deleteCachedValue(globalOpts.store, cacheKey)
533
- return dispatch(opts, new CacheHandler(globalOpts, cacheKey, handler))
600
+ return refetch()
534
601
  }
535
602
  }
536
603
 
@@ -666,6 +733,28 @@ module.exports = (opts = {}) => {
666
733
  reqCacheControl,
667
734
  result
668
735
  ))
736
+ .catch((err) => {
737
+ // Any throw escaping handleResult on the async-store path (e.g. a
738
+ // rejection from store.get() itself, or a throw in a code path not
739
+ // converged by sendCachedValue) would otherwise surface as an
740
+ // unhandled promise rejection and crash the process. Route it to
741
+ // the handler instead, matching the synchronous store path where
742
+ // the error propagates to the request() call site.
743
+ if (typeof handler.onResponseError === 'function') {
744
+ handler.onResponseError({
745
+ rawHeaders: [],
746
+ rawTrailers: [],
747
+ pause () {},
748
+ resume () {},
749
+ get paused () { return false },
750
+ get aborted () { return false },
751
+ get reason () { return null },
752
+ abort () {}
753
+ }, err)
754
+ } else {
755
+ throw err
756
+ }
757
+ })
669
758
  } else {
670
759
  return handleResult(
671
760
  dispatch,
@@ -240,6 +240,13 @@ function removeTrailingSlash (path) {
240
240
  return path
241
241
  }
242
242
 
243
+ // Only strip slashes from the pathname, not from a query string after it
244
+ const queryIndex = path.indexOf('?')
245
+ const search = queryIndex === -1 ? '' : path.slice(queryIndex)
246
+ if (queryIndex !== -1) {
247
+ path = path.slice(0, queryIndex)
248
+ }
249
+
243
250
  while (path.endsWith('/')) {
244
251
  path = path.slice(0, -1)
245
252
  }
@@ -248,7 +255,7 @@ function removeTrailingSlash (path) {
248
255
  path = '/'
249
256
  }
250
257
 
251
- return path
258
+ return path + search
252
259
  }
253
260
 
254
261
  function buildKey (opts) {
@@ -379,6 +386,9 @@ function dispatchMockReply (mockDispatches, mockDispatch, key, opts, handler, re
379
386
  paused: false,
380
387
  rawHeaders: null,
381
388
  rawTrailers: null,
389
+ get aborted () {
390
+ return aborted
391
+ },
382
392
  pause () {
383
393
  this.paused = true
384
394
  },
@@ -229,16 +229,36 @@ function extractBody (object, keepalive = false) {
229
229
  )
230
230
  }
231
231
 
232
- stream = webidl.is.ReadableStream(object)
233
- ? object
234
- : ReadableStream.from(object).pipeThrough(new TransformStream({
235
- transform (chunk, controller) {
236
- const bytes = isUint8Array(chunk) ? chunk : Buffer.from(chunk)
237
- if (bytes.byteLength) {
238
- controller.enqueue(bytes)
232
+ if (webidl.is.ReadableStream(object)) {
233
+ stream = object
234
+ } else {
235
+ const reader = ReadableStream.from(object).getReader()
236
+ let cancelled = false
237
+ // Do not pull from the iterable until the body is read.
238
+ stream = new ReadableStream({
239
+ async pull (controller) {
240
+ while (true) {
241
+ const { done, value } = await reader.read()
242
+ if (cancelled) {
243
+ return
244
+ }
245
+ if (done) {
246
+ controller.close()
247
+ return
248
+ }
249
+ const bytes = isUint8Array(value) ? value : Buffer.from(value)
250
+ if (bytes.byteLength) {
251
+ controller.enqueue(bytes)
252
+ return
253
+ }
239
254
  }
255
+ },
256
+ cancel (reason) {
257
+ cancelled = true
258
+ return reader.cancel(reason)
240
259
  }
241
- }))
260
+ }, { highWaterMark: 0 })
261
+ }
242
262
  }
243
263
 
244
264
  // 18. If source is a byte sequence, then set action to a
@@ -290,10 +290,7 @@ function fetch (input, init = undefined) {
290
290
  cleanupAbortListeners()
291
291
  },
292
292
  processResponse,
293
- dispatcher: getRequestDispatcher(requestObject), // undici
294
- // Keep requestObject alive to prevent its AbortController from being GC'd
295
- // See https://github.com/nodejs/undici/issues/4627
296
- requestObject
293
+ dispatcher: getRequestDispatcher(requestObject) // undici
297
294
  })
298
295
 
299
296
  // 14. Return p.
@@ -412,8 +409,7 @@ function fetching ({
412
409
  processResponseEndOfBody,
413
410
  processResponseConsumeBody,
414
411
  useParallelQueue = false,
415
- dispatcher = getGlobalDispatcher(), // undici
416
- requestObject = null // Keep alive to prevent AbortController GC, see #4627
412
+ dispatcher = getGlobalDispatcher() // undici
417
413
  }) {
418
414
  // Ensure that the dispatcher is set accordingly
419
415
  assert(dispatcher)
@@ -467,9 +463,7 @@ function fetching ({
467
463
  processResponseConsumeBody,
468
464
  processResponseEndOfBody,
469
465
  taskDestination,
470
- crossOriginIsolatedCapability,
471
- // Keep requestObject alive to prevent its AbortController from being GC'd
472
- requestObject
466
+ crossOriginIsolatedCapability
473
467
  }
474
468
 
475
469
  // 7. If request’s body is a byte sequence, then set request’s body to
@@ -26,60 +26,98 @@ const { webidl } = require('../webidl')
26
26
  const { URLSerializer } = require('./data-url')
27
27
  const { kConstruct } = require('../../core/symbols')
28
28
  const assert = require('node:assert')
29
- const { getMaxListeners, setMaxListeners, defaultMaxListeners } = require('node:events')
30
29
 
31
- const kAbortController = Symbol('abortController')
32
-
33
- const requestFinalizer = new FinalizationRegistry(({ signal, abort }) => {
34
- signal.removeEventListener('abort', abort)
30
+ const requestFinalizer = new FinalizationRegistry(({ signal, reference }) => {
31
+ removeSignalFollower(signal, reference)
35
32
  })
36
33
 
37
- const dependentControllerMap = new WeakMap()
34
+ /**
35
+ * @typedef {object} RequestSignalState
36
+ * @property {AbortController} controller
37
+ * @property {AbortSignal} source
38
+ * @property {WeakRef<AbortController>} reference
39
+ */
40
+
41
+ /** @type {WeakMap<AbortSignal, RequestSignalState>} */
42
+ const requestSignals = new WeakMap()
43
+
44
+ /** @type {WeakMap<AbortSignal, WeakRef<AbortController> | Set<WeakRef<AbortController>>>} */
45
+ const signalFollowers = new WeakMap()
38
46
 
39
- let abortSignalHasEventHandlerLeakWarning
47
+ /**
48
+ * @param {AbortSignal} signal
49
+ * @param {WeakRef<AbortController>} reference
50
+ */
51
+ function removeSignalFollower (signal, reference) {
52
+ const followers = signalFollowers.get(signal)
53
+ if (followers instanceof Set) {
54
+ followers.delete(reference)
55
+ if (followers.size !== 0) return
56
+ }
40
57
 
41
- try {
42
- abortSignalHasEventHandlerLeakWarning = getMaxListeners(new AbortController().signal) > 0
43
- } catch {
44
- abortSignalHasEventHandlerLeakWarning = false
58
+ signal.removeEventListener('abort', abortSignalFollowers)
59
+ signalFollowers.delete(signal)
45
60
  }
46
61
 
47
- function buildAbort (acRef) {
48
- return abort
49
-
50
- function abort () {
51
- const ac = acRef.deref()
52
- if (ac !== undefined) {
53
- // Currently, there is a problem with FinalizationRegistry.
54
- // https://github.com/nodejs/node/issues/49344
55
- // https://github.com/nodejs/node/issues/47748
56
- // In the case of abort, the first step is to unregister from it.
57
- // If the controller can refer to it, it is still registered.
58
- // It will be removed in the future.
59
- requestFinalizer.unregister(abort)
60
-
61
- // Unsubscribe a listener.
62
- // FinalizationRegistry will no longer be called, so this must be done.
63
- this.removeEventListener('abort', abort)
64
-
65
- ac.abort(this.reason)
66
-
67
- const controllerList = dependentControllerMap.get(ac.signal)
68
-
69
- if (controllerList !== undefined) {
70
- if (controllerList.size !== 0) {
71
- for (const ref of controllerList) {
72
- const ctrl = ref.deref()
73
- if (ctrl !== undefined) {
74
- ctrl.abort(this.reason)
75
- }
76
- }
77
- controllerList.clear()
78
- }
79
- dependentControllerMap.delete(ac.signal)
80
- }
62
+ /**
63
+ * @param {WeakRef<AbortController>} reference
64
+ * @param {unknown} reason
65
+ */
66
+ function abortSignalFollower (reference, reason) {
67
+ requestFinalizer.unregister(reference)
68
+ const ac = reference.deref()
69
+ if (ac !== undefined) {
70
+ requestSignals.delete(ac.signal)
71
+ ac.abort(reason)
72
+ }
73
+ }
74
+
75
+ /** @this {AbortSignal} */
76
+ function abortSignalFollowers () {
77
+ this.removeEventListener('abort', abortSignalFollowers)
78
+ const followers = signalFollowers.get(this)
79
+ if (followers instanceof Set) {
80
+ for (const reference of followers) {
81
+ abortSignalFollower(reference, this.reason)
81
82
  }
83
+ followers.clear()
84
+ } else {
85
+ abortSignalFollower(followers, this.reason)
86
+ }
87
+ signalFollowers.delete(this)
88
+ }
89
+
90
+ /**
91
+ * @param {AbortSignal | null | undefined} signal
92
+ */
93
+ function createDependentSignal (signal) {
94
+ const ac = new AbortController()
95
+ if (signal == null) return ac.signal
96
+
97
+ if (signal.aborted) {
98
+ ac.abort(signal.reason)
99
+ return ac.signal
100
+ }
101
+
102
+ const reference = new WeakRef(ac)
103
+ const followers = signalFollowers.get(signal)
104
+ if (followers === undefined) {
105
+ util.addAbortListener(signal, abortSignalFollowers)
106
+ signalFollowers.set(signal, reference)
107
+ } else if (followers instanceof WeakRef) {
108
+ const controllers = new Set()
109
+ controllers.add(followers)
110
+ controllers.add(reference)
111
+ signalFollowers.set(signal, controllers)
112
+ } else {
113
+ followers.add(reference)
82
114
  }
115
+
116
+ requestFinalizer.register(ac, { signal, reference }, reference)
117
+
118
+ // The signal must keep its controller alive even after its Request is collected.
119
+ requestSignals.set(ac.signal, { controller: ac, source: signal, reference })
120
+ return ac.signal
83
121
  }
84
122
 
85
123
  let patchMethodWarning = false
@@ -98,13 +136,6 @@ class Request {
98
136
 
99
137
  #state
100
138
 
101
- /**
102
- * Removes the `abort` listener that makes this request's signal follow the
103
- * passed signal. `null` when no such listener was registered.
104
- * @type {(() => void) | null}
105
- */
106
- #abortCleanup = null
107
-
108
139
  // https://fetch.spec.whatwg.org/#dom-request
109
140
  constructor (input, init = undefined) {
110
141
  webidl.util.markAsUncloneable(this)
@@ -418,51 +449,8 @@ class Request {
418
449
  // 27. Set this’s request to request.
419
450
  this.#state = request
420
451
 
421
- // 28. Set this’s signal to a new AbortSignal object with this’s relevant
422
- // Realm.
423
- // TODO: could this be simplified with AbortSignal.any
424
- // (https://dom.spec.whatwg.org/#dom-abortsignal-any)
425
- const ac = new AbortController()
426
- this.#signal = ac.signal
427
-
428
- // 29. If signal is not null, then make this’s signal follow signal.
429
- if (signal != null) {
430
- if (signal.aborted) {
431
- ac.abort(signal.reason)
432
- } else {
433
- // Keep a strong ref to ac while request object
434
- // is alive. This is needed to prevent AbortController
435
- // from being prematurely garbage collected.
436
- // See, https://github.com/nodejs/undici/issues/1926.
437
- this[kAbortController] = ac
438
-
439
- const acRef = new WeakRef(ac)
440
- const abort = buildAbort(acRef)
441
-
442
- // If the max amount of listeners is equal to the default, increase it
443
- if (abortSignalHasEventHandlerLeakWarning && getMaxListeners(signal) === defaultMaxListeners) {
444
- setMaxListeners(1500, signal)
445
- }
446
-
447
- const removeAbortListener = util.addAbortListener(signal, abort)
448
- // The third argument must be a registry key to be unregistered.
449
- // Without it, you cannot unregister.
450
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
451
- // abort is used as the unregister key. (because it is unique)
452
- requestFinalizer.register(ac, { signal, abort }, abort)
453
-
454
- // Allow the listener to be removed deterministically once the fetch
455
- // that owns this request has settled, instead of relying solely on the
456
- // FinalizationRegistry (i.e. garbage collection). Reusing a single
457
- // signal across many requests would otherwise leak listeners.
458
- // See https://github.com/nodejs/undici/issues/5285
459
- this.#abortCleanup = () => {
460
- requestFinalizer.unregister(abort)
461
- removeAbortListener()
462
- this.#abortCleanup = null
463
- }
464
- }
465
- }
452
+ // 28-29. Create a signal that follows the supplied signal, if any.
453
+ this.#signal = createDependentSignal(signal)
466
454
 
467
455
  // 30. Set this’s headers to a new Headers object with this’s relevant
468
456
  // Realm, whose header list is request’s header list and guard is
@@ -792,25 +780,10 @@ class Request {
792
780
  // 3. Let clonedRequestObject be the result of creating a Request object,
793
781
  // given clonedRequest, this’s headers’s guard, and this’s relevant Realm.
794
782
  // 4. Make clonedRequestObject’s signal follow this’s signal.
795
- const ac = new AbortController()
796
- if (this.signal.aborted) {
797
- ac.abort(this.signal.reason)
798
- } else {
799
- let list = dependentControllerMap.get(this.signal)
800
- if (list === undefined) {
801
- list = new Set()
802
- dependentControllerMap.set(this.signal, list)
803
- }
804
- const acRef = new WeakRef(ac)
805
- list.add(acRef)
806
- util.addAbortListener(
807
- ac.signal,
808
- buildAbort(acRef)
809
- )
810
- }
783
+ const signal = createDependentSignal(this.#signal)
811
784
 
812
785
  // 4. Return clonedRequestObject.
813
- return fromInnerRequest(clonedRequest, this.#dispatcher, ac.signal, getHeadersGuard(this.#headers))
786
+ return fromInnerRequest(clonedRequest, this.#dispatcher, signal, getHeadersGuard(this.#headers))
814
787
  }
815
788
 
816
789
  [nodeUtil.inspect.custom] (depth, options) {
@@ -894,7 +867,12 @@ class Request {
894
867
  * @param {Request} request
895
868
  */
896
869
  removeRequestAbortListener = (request) => {
897
- request.#abortCleanup?.()
870
+ const state = requestSignals.get(request.#signal)
871
+ if (state !== undefined) {
872
+ requestSignals.delete(request.#signal)
873
+ requestFinalizer.unregister(state.reference)
874
+ removeSignalFollower(state.source, state.reference)
875
+ }
898
876
  }
899
877
 
900
878
  webidl.is.Request = (arg) => {
@@ -197,8 +197,8 @@ function parseMetadata (metadata) {
197
197
  /** @type {MetadataList} */
198
198
  const result = []
199
199
 
200
- // 2. For each item returned by splitting metadata on spaces:
201
- for (const item of metadata.split(' ')) {
200
+ // 2. For each item returned by splitting metadata on ASCII whitespace:
201
+ for (const item of metadata.split(/[\t\n\f\r ]+/)) {
202
202
  // 1. Let expression-and-options be the result of splitting item on U+003F (?).
203
203
  const expressionAndOptions = item.split('?', 1)
204
204
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "undici",
3
- "version": "8.12.2",
3
+ "version": "8.12.4",
4
4
  "description": "An HTTP/1.1 client, written from scratch for Node.js",
5
5
  "homepage": "https://undici.nodejs.org",
6
6
  "bugs": {
@@ -111,7 +111,7 @@
111
111
  "prepare": "husky && node ./scripts/platform-shell.js"
112
112
  },
113
113
  "devDependencies": {
114
- "@fastify/busboy": "3.2.3",
114
+ "@fastify/busboy": "3.2.4",
115
115
  "@matteo.collina/tspl": "^0.2.0",
116
116
  "@metcoder95/https-pem": "^1.0.0",
117
117
  "@sinonjs/fake-timers": "^12.0.0",
@@ -122,12 +122,12 @@
122
122
  "cross-env": "^10.0.0",
123
123
  "dns-packet": "^5.4.0",
124
124
  "esbuild": "^0.28.0",
125
- "eslint": "^9.9.0",
125
+ "eslint": "^10.12.0",
126
126
  "fast-check": "^4.1.1",
127
127
  "husky": "^9.0.7",
128
128
  "jest": "^30.0.5",
129
129
  "jsondiffpatch": "^0.7.3",
130
- "neostandard": "^0.13.0",
130
+ "neostandard": "^0.14.0",
131
131
  "node-forge": "^1.3.1",
132
132
  "proxy": "^4.0.0",
133
133
  "tsd": "^0.33.0",
package/types/api.d.ts CHANGED
@@ -5,7 +5,7 @@ import Dispatcher from './dispatcher'
5
5
  /** Performs an HTTP request. */
6
6
  declare function request<TOpaque = null> (
7
7
  url: string | URL | UrlObject,
8
- options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.RequestOptions<TOpaque>, 'origin' | 'path' | 'method'> & Partial<Pick<Dispatcher.RequestOptions, 'method'>>,
8
+ options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.RequestOptions<TOpaque>, 'origin' | 'path' | 'method'> & Partial<Pick<Dispatcher.RequestOptions, 'method'>>
9
9
  ): Promise<Dispatcher.ResponseData<TOpaque>>
10
10
 
11
11
  /** A faster version of `request`. */
@@ -231,7 +231,7 @@ declare namespace Dispatcher {
231
231
  onRequestSent?(): void;
232
232
  }
233
233
  export type PipelineHandler<TOpaque = null> = (data: PipelineHandlerData<TOpaque>) => Readable
234
- export type HttpMethod = Autocomplete<'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'>
234
+ export type HttpMethod = Autocomplete<'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH' | 'QUERY'>
235
235
 
236
236
  /**
237
237
  * @link https://fetch.spec.whatwg.org/#body-mixin
@@ -76,33 +76,33 @@ export declare class FormData {
76
76
  /**
77
77
  * Executes given callback function for each field of the FormData instance
78
78
  */
79
- forEach: (
79
+ forEach (
80
80
  callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData) => void,
81
81
  thisArg?: unknown
82
- ) => void
82
+ ): void
83
83
 
84
84
  /**
85
85
  * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all keys contained in this `FormData` object.
86
86
  * Each key is a `string`.
87
87
  */
88
- keys: () => SpecIterableIterator<string>
88
+ keys (): SpecIterableIterator<string>
89
89
 
90
90
  /**
91
91
  * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all values contained in this object `FormData` object.
92
92
  * Each value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
93
93
  */
94
- values: () => SpecIterableIterator<FormDataEntryValue>
94
+ values (): SpecIterableIterator<FormDataEntryValue>
95
95
 
96
96
  /**
97
97
  * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through the `FormData` key/value pairs.
98
98
  * The key of each pair is a string; the value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
99
99
  */
100
- entries: () => SpecIterableIterator<[string, FormDataEntryValue]>
100
+ entries (): SpecIterableIterator<[string, FormDataEntryValue]>
101
101
 
102
102
  /**
103
103
  * An alias for FormData#entries()
104
104
  */
105
- [Symbol.iterator]: () => SpecIterableIterator<[string, FormDataEntryValue]>
105
+ [Symbol.iterator] (): SpecIterableIterator<[string, FormDataEntryValue]>
106
106
 
107
107
  readonly [Symbol.toStringTag]: string
108
108
  }