@nocobase/plugin-idp-oauth 2.1.0-alpha.17 → 2.1.0-alpha.18

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.
Files changed (214) hide show
  1. package/build.config.ts +1 -1
  2. package/dist/externalVersion.js +4 -4
  3. package/dist/node_modules/light-my-request/package.json +1 -1
  4. package/dist/node_modules/undici/LICENSE +21 -0
  5. package/dist/node_modules/undici/README.md +741 -0
  6. package/dist/node_modules/undici/docs/docs/api/Agent.md +84 -0
  7. package/dist/node_modules/undici/docs/docs/api/BalancedPool.md +99 -0
  8. package/dist/node_modules/undici/docs/docs/api/CacheStorage.md +30 -0
  9. package/dist/node_modules/undici/docs/docs/api/CacheStore.md +164 -0
  10. package/dist/node_modules/undici/docs/docs/api/Client.md +285 -0
  11. package/dist/node_modules/undici/docs/docs/api/ClientStats.md +27 -0
  12. package/dist/node_modules/undici/docs/docs/api/Connector.md +115 -0
  13. package/dist/node_modules/undici/docs/docs/api/ContentType.md +57 -0
  14. package/dist/node_modules/undici/docs/docs/api/Cookies.md +101 -0
  15. package/dist/node_modules/undici/docs/docs/api/Debug.md +62 -0
  16. package/dist/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +315 -0
  17. package/dist/node_modules/undici/docs/docs/api/Dispatcher.md +1392 -0
  18. package/dist/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +159 -0
  19. package/dist/node_modules/undici/docs/docs/api/Errors.md +49 -0
  20. package/dist/node_modules/undici/docs/docs/api/EventSource.md +45 -0
  21. package/dist/node_modules/undici/docs/docs/api/Fetch.md +60 -0
  22. package/dist/node_modules/undici/docs/docs/api/GlobalInstallation.md +139 -0
  23. package/dist/node_modules/undici/docs/docs/api/H2CClient.md +263 -0
  24. package/dist/node_modules/undici/docs/docs/api/MockAgent.md +603 -0
  25. package/dist/node_modules/undici/docs/docs/api/MockCallHistory.md +197 -0
  26. package/dist/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +43 -0
  27. package/dist/node_modules/undici/docs/docs/api/MockClient.md +81 -0
  28. package/dist/node_modules/undici/docs/docs/api/MockErrors.md +12 -0
  29. package/dist/node_modules/undici/docs/docs/api/MockPool.md +555 -0
  30. package/dist/node_modules/undici/docs/docs/api/Pool.md +84 -0
  31. package/dist/node_modules/undici/docs/docs/api/PoolStats.md +35 -0
  32. package/dist/node_modules/undici/docs/docs/api/ProxyAgent.md +229 -0
  33. package/dist/node_modules/undici/docs/docs/api/RedirectHandler.md +93 -0
  34. package/dist/node_modules/undici/docs/docs/api/RetryAgent.md +50 -0
  35. package/dist/node_modules/undici/docs/docs/api/RetryHandler.md +118 -0
  36. package/dist/node_modules/undici/docs/docs/api/RoundRobinPool.md +145 -0
  37. package/dist/node_modules/undici/docs/docs/api/SnapshotAgent.md +616 -0
  38. package/dist/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +274 -0
  39. package/dist/node_modules/undici/docs/docs/api/Util.md +25 -0
  40. package/dist/node_modules/undici/docs/docs/api/WebSocket.md +141 -0
  41. package/dist/node_modules/undici/docs/docs/api/api-lifecycle.md +91 -0
  42. package/dist/node_modules/undici/docs/docs/best-practices/client-certificate.md +64 -0
  43. package/dist/node_modules/undici/docs/docs/best-practices/crawling.md +58 -0
  44. package/dist/node_modules/undici/docs/docs/best-practices/mocking-request.md +190 -0
  45. package/dist/node_modules/undici/docs/docs/best-practices/proxy.md +127 -0
  46. package/dist/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +224 -0
  47. package/dist/node_modules/undici/docs/docs/best-practices/writing-tests.md +63 -0
  48. package/dist/node_modules/undici/index-fetch.js +65 -0
  49. package/dist/node_modules/undici/index.d.ts +3 -0
  50. package/dist/node_modules/undici/index.js +234 -0
  51. package/dist/node_modules/undici/lib/api/abort-signal.js +59 -0
  52. package/dist/node_modules/undici/lib/api/api-connect.js +110 -0
  53. package/dist/node_modules/undici/lib/api/api-pipeline.js +252 -0
  54. package/dist/node_modules/undici/lib/api/api-request.js +214 -0
  55. package/dist/node_modules/undici/lib/api/api-stream.js +209 -0
  56. package/dist/node_modules/undici/lib/api/api-upgrade.js +111 -0
  57. package/dist/node_modules/undici/lib/api/index.js +7 -0
  58. package/dist/node_modules/undici/lib/api/readable.js +580 -0
  59. package/dist/node_modules/undici/lib/cache/memory-cache-store.js +234 -0
  60. package/dist/node_modules/undici/lib/cache/sqlite-cache-store.js +461 -0
  61. package/dist/node_modules/undici/lib/core/connect.js +137 -0
  62. package/dist/node_modules/undici/lib/core/constants.js +143 -0
  63. package/dist/node_modules/undici/lib/core/diagnostics.js +227 -0
  64. package/dist/node_modules/undici/lib/core/errors.js +477 -0
  65. package/dist/node_modules/undici/lib/core/request.js +438 -0
  66. package/dist/node_modules/undici/lib/core/socks5-client.js +407 -0
  67. package/dist/node_modules/undici/lib/core/socks5-utils.js +203 -0
  68. package/dist/node_modules/undici/lib/core/symbols.js +75 -0
  69. package/dist/node_modules/undici/lib/core/tree.js +160 -0
  70. package/dist/node_modules/undici/lib/core/util.js +992 -0
  71. package/dist/node_modules/undici/lib/dispatcher/agent.js +158 -0
  72. package/dist/node_modules/undici/lib/dispatcher/balanced-pool.js +219 -0
  73. package/dist/node_modules/undici/lib/dispatcher/client-h1.js +1610 -0
  74. package/dist/node_modules/undici/lib/dispatcher/client-h2.js +995 -0
  75. package/dist/node_modules/undici/lib/dispatcher/client.js +659 -0
  76. package/dist/node_modules/undici/lib/dispatcher/dispatcher-base.js +165 -0
  77. package/dist/node_modules/undici/lib/dispatcher/dispatcher.js +48 -0
  78. package/dist/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +146 -0
  79. package/dist/node_modules/undici/lib/dispatcher/fixed-queue.js +135 -0
  80. package/dist/node_modules/undici/lib/dispatcher/h2c-client.js +51 -0
  81. package/dist/node_modules/undici/lib/dispatcher/pool-base.js +214 -0
  82. package/dist/node_modules/undici/lib/dispatcher/pool.js +118 -0
  83. package/dist/node_modules/undici/lib/dispatcher/proxy-agent.js +318 -0
  84. package/dist/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
  85. package/dist/node_modules/undici/lib/dispatcher/round-robin-pool.js +137 -0
  86. package/dist/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +249 -0
  87. package/dist/node_modules/undici/lib/encoding/index.js +33 -0
  88. package/dist/node_modules/undici/lib/global.js +50 -0
  89. package/dist/node_modules/undici/lib/handler/cache-handler.js +578 -0
  90. package/dist/node_modules/undici/lib/handler/cache-revalidation-handler.js +124 -0
  91. package/dist/node_modules/undici/lib/handler/decorator-handler.js +67 -0
  92. package/dist/node_modules/undici/lib/handler/deduplication-handler.js +460 -0
  93. package/dist/node_modules/undici/lib/handler/redirect-handler.js +238 -0
  94. package/dist/node_modules/undici/lib/handler/retry-handler.js +394 -0
  95. package/dist/node_modules/undici/lib/handler/unwrap-handler.js +100 -0
  96. package/dist/node_modules/undici/lib/handler/wrap-handler.js +105 -0
  97. package/dist/node_modules/undici/lib/interceptor/cache.js +495 -0
  98. package/dist/node_modules/undici/lib/interceptor/decompress.js +259 -0
  99. package/dist/node_modules/undici/lib/interceptor/deduplicate.js +117 -0
  100. package/dist/node_modules/undici/lib/interceptor/dns.js +571 -0
  101. package/dist/node_modules/undici/lib/interceptor/dump.js +112 -0
  102. package/dist/node_modules/undici/lib/interceptor/redirect.js +21 -0
  103. package/dist/node_modules/undici/lib/interceptor/response-error.js +95 -0
  104. package/dist/node_modules/undici/lib/interceptor/retry.js +19 -0
  105. package/dist/node_modules/undici/lib/llhttp/.gitkeep +0 -0
  106. package/dist/node_modules/undici/lib/llhttp/constants.d.ts +195 -0
  107. package/dist/node_modules/undici/lib/llhttp/constants.js +531 -0
  108. package/dist/node_modules/undici/lib/llhttp/llhttp-wasm.js +15 -0
  109. package/dist/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +15 -0
  110. package/dist/node_modules/undici/lib/llhttp/utils.d.ts +2 -0
  111. package/dist/node_modules/undici/lib/llhttp/utils.js +12 -0
  112. package/dist/node_modules/undici/lib/mock/mock-agent.js +232 -0
  113. package/dist/node_modules/undici/lib/mock/mock-call-history.js +248 -0
  114. package/dist/node_modules/undici/lib/mock/mock-client.js +68 -0
  115. package/dist/node_modules/undici/lib/mock/mock-errors.js +29 -0
  116. package/dist/node_modules/undici/lib/mock/mock-interceptor.js +209 -0
  117. package/dist/node_modules/undici/lib/mock/mock-pool.js +68 -0
  118. package/dist/node_modules/undici/lib/mock/mock-symbols.js +32 -0
  119. package/dist/node_modules/undici/lib/mock/mock-utils.js +486 -0
  120. package/dist/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
  121. package/dist/node_modules/undici/lib/mock/snapshot-agent.js +353 -0
  122. package/dist/node_modules/undici/lib/mock/snapshot-recorder.js +588 -0
  123. package/dist/node_modules/undici/lib/mock/snapshot-utils.js +158 -0
  124. package/dist/node_modules/undici/lib/util/cache.js +407 -0
  125. package/dist/node_modules/undici/lib/util/date.js +653 -0
  126. package/dist/node_modules/undici/lib/util/promise.js +28 -0
  127. package/dist/node_modules/undici/lib/util/runtime-features.js +124 -0
  128. package/dist/node_modules/undici/lib/util/stats.js +32 -0
  129. package/dist/node_modules/undici/lib/util/timers.js +425 -0
  130. package/dist/node_modules/undici/lib/web/cache/cache.js +864 -0
  131. package/dist/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
  132. package/dist/node_modules/undici/lib/web/cache/util.js +45 -0
  133. package/dist/node_modules/undici/lib/web/cookies/constants.js +12 -0
  134. package/dist/node_modules/undici/lib/web/cookies/index.js +199 -0
  135. package/dist/node_modules/undici/lib/web/cookies/parse.js +322 -0
  136. package/dist/node_modules/undici/lib/web/cookies/util.js +282 -0
  137. package/dist/node_modules/undici/lib/web/eventsource/eventsource-stream.js +399 -0
  138. package/dist/node_modules/undici/lib/web/eventsource/eventsource.js +501 -0
  139. package/dist/node_modules/undici/lib/web/eventsource/util.js +29 -0
  140. package/dist/node_modules/undici/lib/web/fetch/LICENSE +21 -0
  141. package/dist/node_modules/undici/lib/web/fetch/body.js +509 -0
  142. package/dist/node_modules/undici/lib/web/fetch/constants.js +131 -0
  143. package/dist/node_modules/undici/lib/web/fetch/data-url.js +596 -0
  144. package/dist/node_modules/undici/lib/web/fetch/formdata-parser.js +575 -0
  145. package/dist/node_modules/undici/lib/web/fetch/formdata.js +259 -0
  146. package/dist/node_modules/undici/lib/web/fetch/global.js +40 -0
  147. package/dist/node_modules/undici/lib/web/fetch/headers.js +719 -0
  148. package/dist/node_modules/undici/lib/web/fetch/index.js +2397 -0
  149. package/dist/node_modules/undici/lib/web/fetch/request.js +1115 -0
  150. package/dist/node_modules/undici/lib/web/fetch/response.js +641 -0
  151. package/dist/node_modules/undici/lib/web/fetch/util.js +1520 -0
  152. package/dist/node_modules/undici/lib/web/infra/index.js +229 -0
  153. package/dist/node_modules/undici/lib/web/subresource-integrity/Readme.md +9 -0
  154. package/dist/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +307 -0
  155. package/dist/node_modules/undici/lib/web/webidl/index.js +1006 -0
  156. package/dist/node_modules/undici/lib/web/websocket/connection.js +329 -0
  157. package/dist/node_modules/undici/lib/web/websocket/constants.js +126 -0
  158. package/dist/node_modules/undici/lib/web/websocket/events.js +331 -0
  159. package/dist/node_modules/undici/lib/web/websocket/frame.js +133 -0
  160. package/dist/node_modules/undici/lib/web/websocket/permessage-deflate.js +118 -0
  161. package/dist/node_modules/undici/lib/web/websocket/receiver.js +450 -0
  162. package/dist/node_modules/undici/lib/web/websocket/sender.js +109 -0
  163. package/dist/node_modules/undici/lib/web/websocket/stream/websocketerror.js +104 -0
  164. package/dist/node_modules/undici/lib/web/websocket/stream/websocketstream.js +497 -0
  165. package/dist/node_modules/undici/lib/web/websocket/util.js +347 -0
  166. package/dist/node_modules/undici/lib/web/websocket/websocket.js +751 -0
  167. package/dist/node_modules/undici/package.json +152 -0
  168. package/dist/node_modules/undici/scripts/strip-comments.js +10 -0
  169. package/dist/node_modules/undici/types/README.md +6 -0
  170. package/dist/node_modules/undici/types/agent.d.ts +32 -0
  171. package/dist/node_modules/undici/types/api.d.ts +43 -0
  172. package/dist/node_modules/undici/types/balanced-pool.d.ts +30 -0
  173. package/dist/node_modules/undici/types/cache-interceptor.d.ts +179 -0
  174. package/dist/node_modules/undici/types/cache.d.ts +36 -0
  175. package/dist/node_modules/undici/types/client-stats.d.ts +15 -0
  176. package/dist/node_modules/undici/types/client.d.ts +123 -0
  177. package/dist/node_modules/undici/types/connector.d.ts +36 -0
  178. package/dist/node_modules/undici/types/content-type.d.ts +21 -0
  179. package/dist/node_modules/undici/types/cookies.d.ts +30 -0
  180. package/dist/node_modules/undici/types/diagnostics-channel.d.ts +74 -0
  181. package/dist/node_modules/undici/types/dispatcher.d.ts +273 -0
  182. package/dist/node_modules/undici/types/env-http-proxy-agent.d.ts +22 -0
  183. package/dist/node_modules/undici/types/errors.d.ts +177 -0
  184. package/dist/node_modules/undici/types/eventsource.d.ts +66 -0
  185. package/dist/node_modules/undici/types/fetch.d.ts +231 -0
  186. package/dist/node_modules/undici/types/formdata.d.ts +114 -0
  187. package/dist/node_modules/undici/types/global-dispatcher.d.ts +9 -0
  188. package/dist/node_modules/undici/types/global-origin.d.ts +7 -0
  189. package/dist/node_modules/undici/types/h2c-client.d.ts +73 -0
  190. package/dist/node_modules/undici/types/handlers.d.ts +14 -0
  191. package/dist/node_modules/undici/types/header.d.ts +160 -0
  192. package/dist/node_modules/undici/types/index.d.ts +91 -0
  193. package/dist/node_modules/undici/types/interceptors.d.ts +80 -0
  194. package/dist/node_modules/undici/types/mock-agent.d.ts +68 -0
  195. package/dist/node_modules/undici/types/mock-call-history.d.ts +111 -0
  196. package/dist/node_modules/undici/types/mock-client.d.ts +27 -0
  197. package/dist/node_modules/undici/types/mock-errors.d.ts +12 -0
  198. package/dist/node_modules/undici/types/mock-interceptor.d.ts +94 -0
  199. package/dist/node_modules/undici/types/mock-pool.d.ts +27 -0
  200. package/dist/node_modules/undici/types/patch.d.ts +29 -0
  201. package/dist/node_modules/undici/types/pool-stats.d.ts +19 -0
  202. package/dist/node_modules/undici/types/pool.d.ts +41 -0
  203. package/dist/node_modules/undici/types/proxy-agent.d.ts +29 -0
  204. package/dist/node_modules/undici/types/readable.d.ts +68 -0
  205. package/dist/node_modules/undici/types/retry-agent.d.ts +8 -0
  206. package/dist/node_modules/undici/types/retry-handler.d.ts +125 -0
  207. package/dist/node_modules/undici/types/round-robin-pool.d.ts +41 -0
  208. package/dist/node_modules/undici/types/snapshot-agent.d.ts +109 -0
  209. package/dist/node_modules/undici/types/socks5-proxy-agent.d.ts +25 -0
  210. package/dist/node_modules/undici/types/util.d.ts +18 -0
  211. package/dist/node_modules/undici/types/utility.d.ts +7 -0
  212. package/dist/node_modules/undici/types/webidl.d.ts +347 -0
  213. package/dist/node_modules/undici/types/websocket.d.ts +188 -0
  214. package/package.json +2 -2
@@ -0,0 +1,741 @@
1
+ # undici
2
+
3
+ [![Node CI](https://github.com/nodejs/undici/actions/workflows/ci.yml/badge.svg)](https://github.com/nodejs/undici/actions/workflows/nodejs.yml) [![neostandard javascript style](https://img.shields.io/badge/neo-standard-7fffff?style=flat\&labelColor=ff80ff)](https://github.com/neostandard/neostandard) [![npm version](https://badge.fury.io/js/undici.svg)](https://badge.fury.io/js/undici) [![codecov](https://codecov.io/gh/nodejs/undici/branch/main/graph/badge.svg?token=yZL6LtXkOA)](https://codecov.io/gh/nodejs/undici)
4
+
5
+ An HTTP/1.1 client, written from scratch for Node.js.
6
+
7
+ > Undici means eleven in Italian. 1.1 -> 11 -> Eleven -> Undici.
8
+ It is also a Stranger Things reference.
9
+
10
+ ## How to get involved
11
+
12
+ Have a question about using Undici? Open a [Q&A Discussion](https://github.com/nodejs/undici/discussions/new) or join our official OpenJS [Slack](https://openjs-foundation.slack.com/archives/C01QF9Q31QD) channel.
13
+
14
+ Looking to contribute? Start by reading the [contributing guide](./CONTRIBUTING.md)
15
+
16
+ ## Install
17
+
18
+ ```
19
+ npm i undici
20
+ ```
21
+
22
+ ## Benchmarks
23
+
24
+ The benchmark is a simple getting data [example](https://github.com/nodejs/undici/blob/main/benchmarks/benchmark.js) using a
25
+ 50 TCP connections with a pipelining depth of 10 running on Node 22.11.0.
26
+
27
+ ```
28
+ ┌────────────────────────┬─────────┬────────────────────┬────────────┬─────────────────────────┐
29
+ │ Tests │ Samples │ Result │ Tolerance │ Difference with slowest │
30
+ ├────────────────────────┼─────────┼────────────────────┼────────────┼─────────────────────────┤
31
+ │ 'axios' │ 15 │ '5708.26 req/sec' │ '± 2.91 %' │ '-' │
32
+ │ 'http - no keepalive' │ 10 │ '5809.80 req/sec' │ '± 2.30 %' │ '+ 1.78 %' │
33
+ │ 'request' │ 30 │ '5828.80 req/sec' │ '± 2.91 %' │ '+ 2.11 %' │
34
+ │ 'undici - fetch' │ 40 │ '5903.78 req/sec' │ '± 2.87 %' │ '+ 3.43 %' │
35
+ │ 'node-fetch' │ 10 │ '5945.40 req/sec' │ '± 2.13 %' │ '+ 4.15 %' │
36
+ │ 'got' │ 35 │ '6511.45 req/sec' │ '± 2.84 %' │ '+ 14.07 %' │
37
+ │ 'http - keepalive' │ 65 │ '9193.24 req/sec' │ '± 2.92 %' │ '+ 61.05 %' │
38
+ │ 'superagent' │ 35 │ '9339.43 req/sec' │ '± 2.95 %' │ '+ 63.61 %' │
39
+ │ 'undici - pipeline' │ 50 │ '13364.62 req/sec' │ '± 2.93 %' │ '+ 134.13 %' │
40
+ │ 'undici - stream' │ 95 │ '18245.36 req/sec' │ '± 2.99 %' │ '+ 219.63 %' │
41
+ │ 'undici - request' │ 50 │ '18340.17 req/sec' │ '± 2.84 %' │ '+ 221.29 %' │
42
+ │ 'undici - dispatch' │ 40 │ '22234.42 req/sec' │ '± 2.94 %' │ '+ 289.51 %' │
43
+ └────────────────────────┴─────────┴────────────────────┴────────────┴─────────────────────────┘
44
+ ```
45
+
46
+ ## Undici vs. Fetch
47
+
48
+ ### Overview
49
+
50
+ Node.js includes a built-in `fetch()` implementation powered by undici starting from Node.js v18. However, there are important differences between using the built-in fetch and installing undici as a separate module.
51
+
52
+ ### Built-in Fetch (Node.js v18+)
53
+
54
+ Node.js's built-in fetch is powered by a bundled version of undici:
55
+
56
+ ```js
57
+ // Available globally in Node.js v18+
58
+ const response = await fetch('https://api.example.com/data');
59
+ const data = await response.json();
60
+
61
+ // Check the bundled undici version
62
+ console.log(process.versions.undici); // e.g., "5.28.4"
63
+ ```
64
+
65
+ **Pros:**
66
+ - No additional dependencies required
67
+ - Works across different JavaScript runtimes
68
+ - Automatic compression handling (gzip, deflate, br)
69
+ - Built-in caching support (in development)
70
+
71
+ **Cons:**
72
+ - Limited to the undici version bundled with your Node.js version
73
+ - Less control over connection pooling and advanced features
74
+ - Error handling follows Web API standards (errors wrapped in `TypeError`)
75
+ - Performance overhead due to Web Streams implementation
76
+
77
+ ### Undici Module
78
+
79
+ Installing undici as a separate module gives you access to the latest features and APIs:
80
+
81
+ ```bash
82
+ npm install undici
83
+ ```
84
+
85
+ ```js
86
+ import { request, fetch, Agent, setGlobalDispatcher } from 'undici';
87
+
88
+ // Use undici.request for maximum performance
89
+ const { statusCode, headers, body } = await request('https://api.example.com/data');
90
+ const data = await body.json();
91
+
92
+ // Or use undici.fetch with custom configuration
93
+ const agent = new Agent({ keepAliveTimeout: 10000 });
94
+ setGlobalDispatcher(agent);
95
+ const response = await fetch('https://api.example.com/data');
96
+ ```
97
+
98
+ **Pros:**
99
+ - Latest undici features and bug fixes
100
+ - Access to advanced APIs (`request`, `stream`, `pipeline`)
101
+ - Fine-grained control over connection pooling
102
+ - Better error handling with clearer error messages
103
+ - Superior performance, especially with `undici.request`
104
+ - HTTP/1.1 pipelining support
105
+ - Custom interceptors and middleware
106
+ - Advanced features like `ProxyAgent`, `Socks5Agent`, `MockAgent`
107
+
108
+ **Cons:**
109
+ - Additional dependency to manage
110
+ - Larger bundle size
111
+
112
+ ### When to Use Each
113
+
114
+ #### Use Built-in Fetch When:
115
+ - You want zero dependencies
116
+ - Building isomorphic code that runs in browsers and Node.js
117
+ - Publishing to npm and want to maximize compatibility with JS runtimes
118
+ - Simple HTTP requests without advanced configuration
119
+ - You're publishing to npm and you want to maximize compatiblity
120
+ - You don't depend on features from a specific version of undici
121
+
122
+ #### Use Undici Module When:
123
+ - You need the latest undici features and performance improvements
124
+ - You require advanced connection pooling configuration
125
+ - You need APIs not available in the built-in fetch (`ProxyAgent`, `Socks5Agent`, `MockAgent`, etc.)
126
+ - Performance is critical (use `undici.request` for maximum speed)
127
+ - You want better error handling and debugging capabilities
128
+ - You need HTTP/1.1 pipelining or advanced interceptors
129
+ - You prefer decoupled protocol and API interfaces
130
+
131
+ ### Performance Comparison
132
+
133
+ Based on benchmarks, here's the typical performance hierarchy:
134
+
135
+ 1. **`undici.request()`** - Fastest, most efficient
136
+ 2. **`undici.fetch()`** - Good performance, standard compliance
137
+ 3. **Node.js `http`/`https`** - Baseline performance
138
+
139
+ ### Migration Guide
140
+
141
+ If you're currently using built-in fetch and want to migrate to undici:
142
+
143
+ ```js
144
+ // Before: Built-in fetch
145
+ const response = await fetch('https://api.example.com/data');
146
+
147
+ // After: Undici fetch (drop-in replacement)
148
+ import { fetch } from 'undici';
149
+ const response = await fetch('https://api.example.com/data');
150
+
151
+ // Or: Undici request (better performance)
152
+ import { request } from 'undici';
153
+ const { statusCode, body } = await request('https://api.example.com/data');
154
+ const data = await body.json();
155
+ ```
156
+
157
+ ### Keep `fetch` and `FormData` together
158
+
159
+ When you send a `FormData` body, keep `fetch` and `FormData` from the same
160
+ implementation.
161
+
162
+ Use one of these patterns:
163
+
164
+ ```js
165
+ // Built-in globals
166
+ const body = new FormData()
167
+ body.set('name', 'some')
168
+ await fetch('https://example.com', {
169
+ method: 'POST',
170
+ body
171
+ })
172
+ ```
173
+
174
+ ```js
175
+ // undici module imports
176
+ import { fetch, FormData } from 'undici'
177
+
178
+ const body = new FormData()
179
+ body.set('name', 'some')
180
+ await fetch('https://example.com', {
181
+ method: 'POST',
182
+ body
183
+ })
184
+ ```
185
+
186
+ If you want the installed `undici` package to provide the globals, call
187
+ `install()` first:
188
+
189
+ ```js
190
+ import { install } from 'undici'
191
+
192
+ install()
193
+
194
+ const body = new FormData()
195
+ body.set('name', 'some')
196
+ await fetch('https://example.com', {
197
+ method: 'POST',
198
+ body
199
+ })
200
+ ```
201
+
202
+ `install()` replaces the global `fetch`, `Headers`, `Response`, `Request`, and
203
+ `FormData` implementations with undici's versions, so they all match.
204
+
205
+ Avoid mixing a global `FormData` with `undici.fetch()`, or `undici.FormData`
206
+ with the built-in global `fetch()`.
207
+
208
+ ### Version Compatibility
209
+
210
+ You can check which version of undici is bundled with your Node.js version:
211
+
212
+ ```js
213
+ console.log(process.versions.undici);
214
+ ```
215
+
216
+ Installing undici as a module allows you to use a newer version than what's bundled with Node.js, giving you access to the latest features and performance improvements.
217
+
218
+ ## Quick Start
219
+
220
+ ### Basic Request
221
+
222
+ ```js
223
+ import { request } from 'undici'
224
+
225
+ const {
226
+ statusCode,
227
+ headers,
228
+ trailers,
229
+ body
230
+ } = await request('http://localhost:3000/foo')
231
+
232
+ console.log('response received', statusCode)
233
+ console.log('headers', headers)
234
+
235
+ for await (const data of body) { console.log('data', data) }
236
+
237
+ console.log('trailers', trailers)
238
+ ```
239
+
240
+ ### Using Cache Interceptor
241
+
242
+ Undici provides a powerful HTTP caching interceptor that follows HTTP caching best practices. Here's how to use it:
243
+
244
+ ```js
245
+ import { fetch, Agent, interceptors, cacheStores } from 'undici';
246
+
247
+ // Create a client with cache interceptor
248
+ const client = new Agent().compose(interceptors.cache({
249
+ // Optional: Configure cache store (defaults to MemoryCacheStore)
250
+ store: new cacheStores.MemoryCacheStore({
251
+ maxSize: 100 * 1024 * 1024, // 100MB
252
+ maxCount: 1000,
253
+ maxEntrySize: 5 * 1024 * 1024 // 5MB
254
+ }),
255
+
256
+ // Optional: Specify which HTTP methods to cache (default: ['GET', 'HEAD'])
257
+ methods: ['GET', 'HEAD']
258
+ }));
259
+
260
+ // Set the global dispatcher to use our caching client
261
+ setGlobalDispatcher(client);
262
+
263
+ // Now all fetch requests will use the cache
264
+ async function getData() {
265
+ const response = await fetch('https://api.example.com/data');
266
+ // The server should set appropriate Cache-Control headers in the response
267
+ // which the cache will respect based on the cache policy
268
+ return response.json();
269
+ }
270
+
271
+ // First request - fetches from origin
272
+ const data1 = await getData();
273
+
274
+ // Second request - served from cache if within max-age
275
+ const data2 = await getData();
276
+ ```
277
+
278
+ #### Key Features:
279
+ - **Automatic Caching**: Respects `Cache-Control` and `Expires` headers
280
+ - **Validation**: Supports `ETag` and `Last-Modified` validation
281
+ - **Storage Options**: In-memory or persistent SQLite storage
282
+ - **Flexible**: Configure cache size, TTL, and more
283
+
284
+ ## Global Installation
285
+
286
+ Undici provides an `install()` function to add all WHATWG fetch classes to `globalThis`, making them available globally:
287
+
288
+ ```js
289
+ import { install } from 'undici'
290
+
291
+ // Install all WHATWG fetch classes globally
292
+ install()
293
+
294
+ // Now you can use fetch classes globally without importing
295
+ const response = await fetch('https://api.example.com/data')
296
+ const data = await response.json()
297
+
298
+ // All classes are available globally:
299
+ const headers = new Headers([['content-type', 'application/json']])
300
+ const request = new Request('https://example.com')
301
+ const formData = new FormData()
302
+ const ws = new WebSocket('wss://example.com')
303
+ const eventSource = new EventSource('https://example.com/events')
304
+ ```
305
+
306
+ The `install()` function adds the following classes to `globalThis`:
307
+
308
+ - `fetch` - The fetch function
309
+ - `Headers` - HTTP headers management
310
+ - `Response` - HTTP response representation
311
+ - `Request` - HTTP request representation
312
+ - `FormData` - Form data handling
313
+ - `WebSocket` - WebSocket client
314
+ - `CloseEvent`, `ErrorEvent`, `MessageEvent` - WebSocket events
315
+ - `EventSource` - Server-sent events client
316
+
317
+ When you call `install()`, these globals come from the same undici
318
+ implementation. For example, global `fetch` and global `FormData` will both be
319
+ undici's versions, which is the recommended setup if you want to use undici
320
+ through globals.
321
+
322
+ This is useful for:
323
+ - Polyfilling environments that don't have fetch
324
+ - Ensuring consistent fetch behavior across different Node.js versions
325
+ - Making undici's implementations available globally for libraries that expect them
326
+
327
+ ## Body Mixins
328
+
329
+ The `body` mixins are the most common way to format the request/response body. Mixins include:
330
+
331
+ - [`.arrayBuffer()`](https://fetch.spec.whatwg.org/#dom-body-arraybuffer)
332
+ - [`.blob()`](https://fetch.spec.whatwg.org/#dom-body-blob)
333
+ - [`.bytes()`](https://fetch.spec.whatwg.org/#dom-body-bytes)
334
+ - [`.json()`](https://fetch.spec.whatwg.org/#dom-body-json)
335
+ - [`.text()`](https://fetch.spec.whatwg.org/#dom-body-text)
336
+
337
+ > [!NOTE]
338
+ > The body returned from `undici.request` does not implement `.formData()`.
339
+
340
+ Example usage:
341
+
342
+ ```js
343
+ import { request } from 'undici'
344
+
345
+ const {
346
+ statusCode,
347
+ headers,
348
+ trailers,
349
+ body
350
+ } = await request('http://localhost:3000/foo')
351
+
352
+ console.log('response received', statusCode)
353
+ console.log('headers', headers)
354
+ console.log('data', await body.json())
355
+ console.log('trailers', trailers)
356
+ ```
357
+
358
+ _Note: Once a mixin has been called then the body cannot be reused, thus calling additional mixins on `.body`, e.g. `.body.json(); .body.text()` will result in an error `TypeError: unusable` being thrown and returned through the `Promise` rejection._
359
+
360
+ Should you need to access the `body` in plain-text after using a mixin, the best practice is to use the `.text()` mixin first and then manually parse the text to the desired format.
361
+
362
+ For more information about their behavior, please reference the body mixin from the [Fetch Standard](https://fetch.spec.whatwg.org/#body-mixin).
363
+
364
+ ## Common API Methods
365
+
366
+ This section documents our most commonly used API methods. Additional APIs are documented in their own files within the [docs](./docs/) folder and are accessible via the navigation list on the left side of the docs site.
367
+
368
+ ### `undici.request([url, options]): Promise`
369
+
370
+ Arguments:
371
+
372
+ * **url** `string | URL | UrlObject`
373
+ * **options** [`RequestOptions`](./docs/docs/api/Dispatcher.md#parameter-requestoptions)
374
+ * **dispatcher** `Dispatcher` - Default: [getGlobalDispatcher](#undicigetglobaldispatcher)
375
+ * **method** `String` - Default: `PUT` if `options.body`, otherwise `GET`
376
+
377
+ Returns a promise with the result of the `Dispatcher.request` method.
378
+
379
+ Calls `options.dispatcher.request(options)`.
380
+
381
+ See [Dispatcher.request](./docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback) for more details, and [request examples](./docs/examples/README.md) for examples.
382
+
383
+ ### `undici.stream([url, options, ]factory): Promise`
384
+
385
+ Arguments:
386
+
387
+ * **url** `string | URL | UrlObject`
388
+ * **options** [`StreamOptions`](./docs/docs/api/Dispatcher.md#parameter-streamoptions)
389
+ * **dispatcher** `Dispatcher` - Default: [getGlobalDispatcher](#undicigetglobaldispatcher)
390
+ * **method** `String` - Default: `PUT` if `options.body`, otherwise `GET`
391
+ * **factory** `Dispatcher.stream.factory`
392
+
393
+ Returns a promise with the result of the `Dispatcher.stream` method.
394
+
395
+ Calls `options.dispatcher.stream(options, factory)`.
396
+
397
+ See [Dispatcher.stream](./docs/docs/api/Dispatcher.md#dispatcherstreamoptions-factory-callback) for more details.
398
+
399
+ ### `undici.pipeline([url, options, ]handler): Duplex`
400
+
401
+ Arguments:
402
+
403
+ * **url** `string | URL | UrlObject`
404
+ * **options** [`PipelineOptions`](./docs/docs/api/Dispatcher.md#parameter-pipelineoptions)
405
+ * **dispatcher** `Dispatcher` - Default: [getGlobalDispatcher](#undicigetglobaldispatcher)
406
+ * **method** `String` - Default: `PUT` if `options.body`, otherwise `GET`
407
+ * **handler** `Dispatcher.pipeline.handler`
408
+
409
+ Returns: `stream.Duplex`
410
+
411
+ Calls `options.dispatch.pipeline(options, handler)`.
412
+
413
+ See [Dispatcher.pipeline](./docs/docs/api/Dispatcher.md#dispatcherpipelineoptions-handler) for more details.
414
+
415
+ ### `undici.connect([url, options]): Promise`
416
+
417
+ Starts two-way communications with the requested resource using [HTTP CONNECT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/CONNECT).
418
+
419
+ Arguments:
420
+
421
+ * **url** `string | URL | UrlObject`
422
+ * **options** [`ConnectOptions`](./docs/docs/api/Dispatcher.md#parameter-connectoptions)
423
+ * **dispatcher** `Dispatcher` - Default: [getGlobalDispatcher](#undicigetglobaldispatcher)
424
+ * **callback** `(err: Error | null, data: ConnectData | null) => void` (optional)
425
+
426
+ Returns a promise with the result of the `Dispatcher.connect` method.
427
+
428
+ Calls `options.dispatch.connect(options)`.
429
+
430
+ See [Dispatcher.connect](./docs/docs/api/Dispatcher.md#dispatcherconnectoptions-callback) for more details.
431
+
432
+ ### `undici.fetch(input[, init]): Promise`
433
+
434
+ Implements [fetch](https://fetch.spec.whatwg.org/#fetch-method).
435
+
436
+ * https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch
437
+ * https://fetch.spec.whatwg.org/#fetch-method
438
+
439
+ Basic usage example:
440
+
441
+ ```js
442
+ import { fetch } from 'undici'
443
+
444
+
445
+ const res = await fetch('https://example.com')
446
+ const json = await res.json()
447
+ console.log(json)
448
+ ```
449
+
450
+ You can pass an optional dispatcher to `fetch` as:
451
+
452
+ ```js
453
+ import { fetch, Agent } from 'undici'
454
+
455
+ const res = await fetch('https://example.com', {
456
+ // Mocks are also supported
457
+ dispatcher: new Agent({
458
+ keepAliveTimeout: 10,
459
+ keepAliveMaxTimeout: 10
460
+ })
461
+ })
462
+ const json = await res.json()
463
+ console.log(json)
464
+ ```
465
+
466
+ #### `request.body`
467
+
468
+ A body can be of the following types:
469
+
470
+ - ArrayBuffer
471
+ - ArrayBufferView
472
+ - AsyncIterables
473
+ - Blob
474
+ - Iterables
475
+ - String
476
+ - URLSearchParams
477
+ - FormData
478
+
479
+ In this implementation of fetch, ```request.body``` now accepts ```Async Iterables```. It is not present in the [Fetch Standard](https://fetch.spec.whatwg.org).
480
+
481
+ ```js
482
+ import { fetch } from 'undici'
483
+
484
+ const data = {
485
+ async *[Symbol.asyncIterator]() {
486
+ yield 'hello'
487
+ yield 'world'
488
+ },
489
+ }
490
+
491
+ await fetch('https://example.com', { body: data, method: 'POST', duplex: 'half' })
492
+ ```
493
+
494
+ [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData) besides text data and buffers can also utilize streams via [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) objects:
495
+
496
+ ```js
497
+ import { openAsBlob } from 'node:fs'
498
+
499
+ const file = await openAsBlob('./big.csv')
500
+ const body = new FormData()
501
+ body.set('file', file, 'big.csv')
502
+
503
+ await fetch('http://example.com', { method: 'POST', body })
504
+ ```
505
+
506
+ #### `request.duplex`
507
+
508
+ - `'half'`
509
+
510
+ In this implementation of fetch, `request.duplex` must be set if `request.body` is `ReadableStream` or `Async Iterables`, however, even though the value must be set to `'half'`, it is actually a _full_ duplex. For more detail refer to the [Fetch Standard](https://fetch.spec.whatwg.org/#dom-requestinit-duplex).
511
+
512
+ #### `response.body`
513
+
514
+ Nodejs has two kinds of streams: [web streams](https://nodejs.org/api/webstreams.html), which follow the API of the WHATWG web standard found in browsers, and an older Node-specific [streams API](https://nodejs.org/api/stream.html). `response.body` returns a readable web stream. If you would prefer to work with a Node stream you can convert a web stream using `.fromWeb()`.
515
+
516
+ ```js
517
+ import { fetch } from 'undici'
518
+ import { Readable } from 'node:stream'
519
+
520
+ const response = await fetch('https://example.com')
521
+ const readableWebStream = response.body
522
+ const readableNodeStream = Readable.fromWeb(readableWebStream)
523
+ ```
524
+
525
+ ## Specification Compliance
526
+
527
+ This section documents parts of the [HTTP/1.1](https://www.rfc-editor.org/rfc/rfc9110.html) and [Fetch Standard](https://fetch.spec.whatwg.org) that Undici does
528
+ not support or does not fully implement.
529
+
530
+ #### CORS
531
+
532
+ Unlike browsers, Undici does not implement CORS (Cross-Origin Resource Sharing) checks by default. This means:
533
+
534
+ - No preflight requests are automatically sent for cross-origin requests
535
+ - No validation of `Access-Control-Allow-Origin` headers is performed
536
+ - Requests to any origin are allowed regardless of the source
537
+
538
+ This behavior is intentional for server-side environments where CORS restrictions are typically unnecessary. If your application requires CORS-like protections, you will need to implement these checks manually.
539
+
540
+ #### Garbage Collection
541
+
542
+ * https://fetch.spec.whatwg.org/#garbage-collection
543
+
544
+ The [Fetch Standard](https://fetch.spec.whatwg.org) allows users to skip consuming the response body by relying on
545
+ [garbage collection](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management#garbage_collection) to release connection resources.
546
+
547
+ Garbage collection in Node is less aggressive and deterministic
548
+ (due to the lack of clear idle periods that browsers have through the rendering refresh rate)
549
+ which means that leaving the release of connection resources to the garbage collector can lead
550
+ to excessive connection usage, reduced performance (due to less connection re-use), and even
551
+ stalls or deadlocks when running out of connections.
552
+ Therefore, __it is important to always either consume or cancel the response body anyway__.
553
+
554
+ ```js
555
+ // Do
556
+ const { body, headers } = await fetch(url);
557
+ for await (const chunk of body) {
558
+ // force consumption of body
559
+ }
560
+
561
+ // Do not
562
+ const { headers } = await fetch(url);
563
+ ```
564
+
565
+ However, if you want to get only headers, it might be better to use `HEAD` request method. Usage of this method will obviate the need for consumption or cancelling of the response body. See [MDN - HTTP - HTTP request methods - HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) for more details.
566
+
567
+ ```js
568
+ const headers = await fetch(url, { method: 'HEAD' })
569
+ .then(res => res.headers)
570
+ ```
571
+
572
+ Note that consuming the response body is _mandatory_ for `request`:
573
+
574
+ ```js
575
+ // Do
576
+ const { body, headers } = await request(url);
577
+ await body.dump(); // force consumption of body
578
+
579
+ // Do not
580
+ const { headers } = await request(url);
581
+ ```
582
+
583
+ #### Forbidden and Safelisted Header Names
584
+
585
+ * https://fetch.spec.whatwg.org/#cors-safelisted-response-header-name
586
+ * https://fetch.spec.whatwg.org/#forbidden-header-name
587
+ * https://fetch.spec.whatwg.org/#forbidden-response-header-name
588
+ * https://github.com/wintercg/fetch/issues/6
589
+
590
+ The [Fetch Standard](https://fetch.spec.whatwg.org) requires implementations to exclude certain headers from requests and responses. In browser environments, some headers are forbidden so the user agent remains in full control over them. In Undici, these constraints are removed to give more control to the user.
591
+
592
+ #### Content-Encoding
593
+
594
+ * https://www.rfc-editor.org/rfc/rfc9110#field.content-encoding
595
+
596
+ Undici limits the number of `Content-Encoding` layers in a response to **5** to prevent resource exhaustion attacks. If a server responds with more than 5 content-encodings (e.g., `Content-Encoding: gzip, gzip, gzip, gzip, gzip, gzip`), the fetch will be rejected with an error. This limit matches the approach taken by [curl](https://curl.se/docs/CVE-2022-32206.html) and [urllib3](https://github.com/advisories/GHSA-gm62-xv2j-4rw9).
597
+
598
+ #### `undici.upgrade([url, options]): Promise`
599
+
600
+ Upgrade to a different protocol. See [MDN - HTTP - Protocol upgrade mechanism](https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism) for more details.
601
+
602
+ Arguments:
603
+
604
+ * **url** `string | URL | UrlObject`
605
+ * **options** [`UpgradeOptions`](./docs/docs/api/Dispatcher.md#parameter-upgradeoptions)
606
+ * **dispatcher** `Dispatcher` - Default: [getGlobalDispatcher](#undicigetglobaldispatcher)
607
+ * **callback** `(error: Error | null, data: UpgradeData) => void` (optional)
608
+
609
+ Returns a promise with the result of the `Dispatcher.upgrade` method.
610
+
611
+ Calls `options.dispatcher.upgrade(options)`.
612
+
613
+ See [Dispatcher.upgrade](./docs/docs/api/Dispatcher.md#dispatcherupgradeoptions-callback) for more details.
614
+
615
+ ### `undici.setGlobalDispatcher(dispatcher)`
616
+
617
+ * dispatcher `Dispatcher`
618
+
619
+ Sets the global dispatcher used by Common API Methods. Global dispatcher is shared among compatible undici modules,
620
+ including undici that is bundled internally with node.js.
621
+
622
+ ### `undici.getGlobalDispatcher()`
623
+
624
+ Gets the global dispatcher used by Common API Methods.
625
+
626
+ Returns: `Dispatcher`
627
+
628
+ ### `undici.setGlobalOrigin(origin)`
629
+
630
+ * origin `string | URL | undefined`
631
+
632
+ Sets the global origin used in `fetch`.
633
+
634
+ If `undefined` is passed, the global origin will be reset. This will cause `Response.redirect`, `new Request()`, and `fetch` to throw an error when a relative path is passed.
635
+
636
+ ```js
637
+ setGlobalOrigin('http://localhost:3000')
638
+
639
+ const response = await fetch('/api/ping')
640
+
641
+ console.log(response.url) // http://localhost:3000/api/ping
642
+ ```
643
+
644
+ ### `undici.getGlobalOrigin()`
645
+
646
+ Gets the global origin used in `fetch`.
647
+
648
+ Returns: `URL`
649
+
650
+ ### `UrlObject`
651
+
652
+ * **port** `string | number` (optional)
653
+ * **path** `string` (optional)
654
+ * **pathname** `string` (optional)
655
+ * **hostname** `string` (optional)
656
+ * **origin** `string` (optional)
657
+ * **protocol** `string` (optional)
658
+ * **search** `string` (optional)
659
+
660
+ #### Expect
661
+
662
+ Undici does not support the `Expect` request header field. The request
663
+ body is always immediately sent and the `100 Continue` response will be
664
+ ignored.
665
+
666
+ Refs: https://tools.ietf.org/html/rfc7231#section-5.1.1
667
+
668
+ #### Pipelining
669
+
670
+ Undici will only use pipelining if configured with a `pipelining` factor
671
+ greater than `1`. Also it is important to pass `blocking: false` to the
672
+ request options to properly pipeline requests.
673
+
674
+ Undici always assumes that connections are persistent and will immediately
675
+ pipeline requests, without checking whether the connection is persistent.
676
+ Hence, automatic fallback to HTTP/1.0 or HTTP/1.1 without pipelining is
677
+ not supported.
678
+
679
+ Undici will immediately pipeline when retrying requests after a failed
680
+ connection. However, Undici will not retry the first remaining requests in
681
+ the prior pipeline and instead error the corresponding callback/promise/stream.
682
+
683
+ Undici will abort all running requests in the pipeline when any of them are
684
+ aborted.
685
+
686
+ * Refs: https://tools.ietf.org/html/rfc2616#section-8.1.2.2
687
+ * Refs: https://tools.ietf.org/html/rfc7230#section-6.3.2
688
+
689
+ #### Manual Redirect
690
+
691
+ Since it is not possible to manually follow an HTTP redirect on the server-side,
692
+ Undici returns the actual response instead of an `opaqueredirect` filtered one
693
+ when invoked with a `manual` redirect. This aligns `fetch()` with the other
694
+ implementations in Deno and Cloudflare Workers.
695
+
696
+ Refs: https://fetch.spec.whatwg.org/#atomic-http-redirect-handling
697
+
698
+ ### Workarounds
699
+
700
+ #### Network address family autoselection.
701
+
702
+ If you experience problem when connecting to a remote server that is resolved by your DNS servers to a IPv6 (AAAA record)
703
+ first, there are chances that your local router or ISP might have problem connecting to IPv6 networks. In that case
704
+ undici will throw an error with code `UND_ERR_CONNECT_TIMEOUT`.
705
+
706
+ If the target server resolves to both a IPv6 and IPv4 (A records) address and you are using a compatible Node version
707
+ (18.3.0 and above), you can fix the problem by providing the `autoSelectFamily` option (support by both `undici.request`
708
+ and `undici.Agent`) which will enable the family autoselection algorithm when establishing the connection.
709
+
710
+ ## Collaborators
711
+
712
+ * [__Daniele Belardi__](https://github.com/dnlup), <https://www.npmjs.com/~dnlup>
713
+ * [__Ethan Arrowood__](https://github.com/ethan-arrowood), <https://www.npmjs.com/~ethan_arrowood>
714
+ * [__Matteo Collina__](https://github.com/mcollina), <https://www.npmjs.com/~matteo.collina>
715
+ * [__Matthew Aitken__](https://github.com/KhafraDev), <https://www.npmjs.com/~khaf>
716
+ * [__Robert Nagy__](https://github.com/ronag), <https://www.npmjs.com/~ronag>
717
+ * [__Szymon Marczak__](https://github.com/szmarczak), <https://www.npmjs.com/~szmarczak>
718
+
719
+ ## Past Collaborators
720
+ * [__Tomas Della Vedova__](https://github.com/delvedor), <https://www.npmjs.com/~delvedor>
721
+
722
+ ### Releasers
723
+
724
+ * [__Ethan Arrowood__](https://github.com/ethan-arrowood), <https://www.npmjs.com/~ethan_arrowood>
725
+ * [__Matteo Collina__](https://github.com/mcollina), <https://www.npmjs.com/~matteo.collina>
726
+ * [__Robert Nagy__](https://github.com/ronag), <https://www.npmjs.com/~ronag>
727
+ * [__Matthew Aitken__](https://github.com/KhafraDev), <https://www.npmjs.com/~khaf>
728
+
729
+ ## Long Term Support
730
+
731
+ Undici aligns with the Node.js LTS schedule. The following table shows the supported versions:
732
+
733
+ | Undici Version | Bundled in Node.js | Node.js Versions Supported | End of Life |
734
+ |----------------|-------------------|----------------------------|-------------|
735
+ | 5.x | 18.x | ≥14.0 (tested: 14, 16, 18) | 2024-04-30 |
736
+ | 6.x | 20.x, 22.x | ≥18.17 (tested: 18, 20, 21, 22) | 2026-04-30 |
737
+ | 7.x | 24.x | ≥20.18.1 (tested: 20, 22, 24) | 2027-04-30 |
738
+
739
+ ## License
740
+
741
+ MIT