@noodleseed/one 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/dist/commands/author-loop.d.ts.map +1 -1
  2. package/dist/commands/author-loop.js +2 -2
  3. package/dist/commands/author-loop.js.map +1 -1
  4. package/dist/commands/catalog-dispatch.d.ts.map +1 -1
  5. package/dist/commands/catalog-dispatch.js +21 -2
  6. package/dist/commands/catalog-dispatch.js.map +1 -1
  7. package/dist/commands/deploy-ops.d.ts.map +1 -1
  8. package/dist/commands/deploy-ops.js +28 -11
  9. package/dist/commands/deploy-ops.js.map +1 -1
  10. package/dist/first-run.d.ts +11 -0
  11. package/dist/first-run.d.ts.map +1 -1
  12. package/dist/first-run.js +19 -4
  13. package/dist/first-run.js.map +1 -1
  14. package/dist/project-scaffold-templates.d.ts +11 -0
  15. package/dist/project-scaffold-templates.d.ts.map +1 -0
  16. package/dist/project-scaffold-templates.js +359 -0
  17. package/dist/project-scaffold-templates.js.map +1 -0
  18. package/dist/project.d.ts.map +1 -1
  19. package/dist/project.js +1 -323
  20. package/dist/project.js.map +1 -1
  21. package/dist/react.d.ts +2 -2
  22. package/dist/react.d.ts.map +1 -1
  23. package/dist/react.js +1 -1
  24. package/dist/react.js.map +1 -1
  25. package/dist/validate.d.ts +12 -0
  26. package/dist/validate.d.ts.map +1 -1
  27. package/dist/validate.js +11 -0
  28. package/dist/validate.js.map +1 -1
  29. package/node_modules/@noodle-borg/agent-kit/dist/skill-content.d.ts.map +1 -1
  30. package/node_modules/@noodle-borg/agent-kit/dist/skill-content.js +6 -9
  31. package/node_modules/@noodle-borg/agent-kit/dist/skill-content.js.map +1 -1
  32. package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
  33. package/node_modules/@noodle-borg/authoring/dist/index.d.ts +3 -3
  34. package/node_modules/@noodle-borg/authoring/dist/index.d.ts.map +1 -1
  35. package/node_modules/@noodle-borg/authoring/dist/index.js +1 -1
  36. package/node_modules/@noodle-borg/authoring/dist/index.js.map +1 -1
  37. package/node_modules/@noodle-borg/authoring/dist/react/components.d.ts +302 -7
  38. package/node_modules/@noodle-borg/authoring/dist/react/components.d.ts.map +1 -1
  39. package/node_modules/@noodle-borg/authoring/dist/react/components.js +39 -7
  40. package/node_modules/@noodle-borg/authoring/dist/react/components.js.map +1 -1
  41. package/node_modules/@noodle-borg/authoring/dist/react/index.d.ts +4 -2
  42. package/node_modules/@noodle-borg/authoring/dist/react/index.d.ts.map +1 -1
  43. package/node_modules/@noodle-borg/authoring/dist/react/index.js +2 -1
  44. package/node_modules/@noodle-borg/authoring/dist/react/index.js.map +1 -1
  45. package/node_modules/@noodle-borg/authoring/dist/react/semantic-components.d.ts +2618 -0
  46. package/node_modules/@noodle-borg/authoring/dist/react/semantic-components.d.ts.map +1 -0
  47. package/node_modules/@noodle-borg/authoring/dist/react/semantic-components.js +110 -0
  48. package/node_modules/@noodle-borg/authoring/dist/react/semantic-components.js.map +1 -0
  49. package/node_modules/@noodle-borg/authoring/dist/react.d.ts +2 -2
  50. package/node_modules/@noodle-borg/authoring/dist/react.d.ts.map +1 -1
  51. package/node_modules/@noodle-borg/authoring/dist/react.js +1 -1
  52. package/node_modules/@noodle-borg/authoring/dist/react.js.map +1 -1
  53. package/node_modules/@noodle-borg/authoring/dist/recording.d.ts +1 -1
  54. package/node_modules/@noodle-borg/authoring/dist/recording.d.ts.map +1 -1
  55. package/node_modules/@noodle-borg/authoring/dist/recording.js +14 -1
  56. package/node_modules/@noodle-borg/authoring/dist/recording.js.map +1 -1
  57. package/node_modules/@noodle-borg/authoring/dist/server.d.ts +25 -2
  58. package/node_modules/@noodle-borg/authoring/dist/server.d.ts.map +1 -1
  59. package/node_modules/@noodle-borg/authoring/dist/server.js +7 -3
  60. package/node_modules/@noodle-borg/authoring/dist/server.js.map +1 -1
  61. package/node_modules/@noodle-borg/compiler/dist/compile.d.ts.map +1 -1
  62. package/node_modules/@noodle-borg/compiler/dist/compile.js +20 -8
  63. package/node_modules/@noodle-borg/compiler/dist/compile.js.map +1 -1
  64. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts +2 -0
  65. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts.map +1 -1
  66. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js +6 -0
  67. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js.map +1 -1
  68. package/node_modules/@noodle-borg/connector-http/package.json +1 -1
  69. package/node_modules/@noodle-borg/protocol/dist/mapping.d.ts.map +1 -1
  70. package/node_modules/@noodle-borg/protocol/dist/mapping.js +8 -0
  71. package/node_modules/@noodle-borg/protocol/dist/mapping.js.map +1 -1
  72. package/node_modules/hono/dist/adapter/aws-lambda/handler.js +15 -21
  73. package/node_modules/hono/dist/adapter/bun/websocket.js +3 -1
  74. package/node_modules/hono/dist/adapter/lambda-edge/handler.js +8 -2
  75. package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +15 -21
  76. package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +3 -1
  77. package/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +8 -2
  78. package/node_modules/hono/dist/cjs/helper/css/common.js +3 -1
  79. package/node_modules/hono/dist/cjs/helper/css/index.js +9 -1
  80. package/node_modules/hono/dist/cjs/jsx/base.js +8 -14
  81. package/node_modules/hono/dist/cjs/jsx/components.js +41 -21
  82. package/node_modules/hono/dist/cjs/jsx/context.js +131 -5
  83. package/node_modules/hono/dist/cjs/jsx/streaming.js +9 -7
  84. package/node_modules/hono/dist/cjs/middleware/cors/index.js +2 -5
  85. package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +2 -2
  86. package/node_modules/hono/dist/cjs/utils/body.js +12 -4
  87. package/node_modules/hono/dist/cjs/utils/buffer.js +2 -1
  88. package/node_modules/hono/dist/cjs/validator/validator.js +3 -3
  89. package/node_modules/hono/dist/helper/css/common.js +3 -1
  90. package/node_modules/hono/dist/helper/css/index.js +9 -1
  91. package/node_modules/hono/dist/jsx/base.js +15 -15
  92. package/node_modules/hono/dist/jsx/components.js +42 -22
  93. package/node_modules/hono/dist/jsx/context.js +129 -5
  94. package/node_modules/hono/dist/jsx/streaming.js +10 -8
  95. package/node_modules/hono/dist/middleware/cors/index.js +2 -5
  96. package/node_modules/hono/dist/middleware/serve-static/index.js +2 -2
  97. package/node_modules/hono/dist/types/adapter/aws-lambda/handler.d.ts +1 -1
  98. package/node_modules/hono/dist/types/jsx/base.d.ts +1 -3
  99. package/node_modules/hono/dist/types/jsx/context.d.ts +39 -0
  100. package/node_modules/hono/dist/types/middleware/context-storage/index.d.ts +2 -2
  101. package/node_modules/hono/dist/types/utils/body.d.ts +1 -1
  102. package/node_modules/hono/dist/utils/body.js +12 -4
  103. package/node_modules/hono/dist/utils/buffer.js +2 -1
  104. package/node_modules/hono/dist/validator/validator.js +3 -3
  105. package/node_modules/hono/package.json +9 -10
  106. package/node_modules/tailwindcss/dist/chunk-HMCCH6MG.mjs +1 -0
  107. package/node_modules/tailwindcss/dist/default-theme.mjs +1 -1
  108. package/node_modules/tailwindcss/dist/lib.js +13 -13
  109. package/node_modules/tailwindcss/dist/lib.mjs +18 -18
  110. package/node_modules/tailwindcss/package.json +2 -2
  111. package/node_modules/undici/README.md +3 -2
  112. package/node_modules/undici/docs/docs/api/Agent.md +248 -44
  113. package/node_modules/undici/docs/docs/api/BalancedPool.md +246 -48
  114. package/node_modules/undici/docs/docs/api/CacheStorage.md +171 -13
  115. package/node_modules/undici/docs/docs/api/CacheStore.md +294 -98
  116. package/node_modules/undici/docs/docs/api/Client.md +365 -178
  117. package/node_modules/undici/docs/docs/api/ClientStats.md +80 -14
  118. package/node_modules/undici/docs/docs/api/Connector.md +118 -36
  119. package/node_modules/undici/docs/docs/api/ContentType.md +65 -25
  120. package/node_modules/undici/docs/docs/api/Cookies.md +125 -47
  121. package/node_modules/undici/docs/docs/api/Debug.md +34 -18
  122. package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +364 -164
  123. package/node_modules/undici/docs/docs/api/Dispatcher.md +479 -1093
  124. package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +101 -87
  125. package/node_modules/undici/docs/docs/api/Errors.md +503 -40
  126. package/node_modules/undici/docs/docs/api/EventSource.md +294 -32
  127. package/node_modules/undici/docs/docs/api/Fetch.md +680 -31
  128. package/node_modules/undici/docs/docs/api/GlobalInstallation.md +78 -98
  129. package/node_modules/undici/docs/docs/api/H2CClient.md +298 -176
  130. package/node_modules/undici/docs/docs/api/Interceptors.md +355 -0
  131. package/node_modules/undici/docs/docs/api/MockAgent.md +314 -322
  132. package/node_modules/undici/docs/docs/api/MockCallHistory.md +272 -98
  133. package/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +189 -26
  134. package/node_modules/undici/docs/docs/api/MockClient.md +151 -33
  135. package/node_modules/undici/docs/docs/api/MockErrors.md +56 -5
  136. package/node_modules/undici/docs/docs/api/MockPool.md +299 -263
  137. package/node_modules/undici/docs/docs/api/Pool.md +235 -43
  138. package/node_modules/undici/docs/docs/api/PoolStats.md +119 -13
  139. package/node_modules/undici/docs/docs/api/ProxyAgent.md +179 -160
  140. package/node_modules/undici/docs/docs/api/RedirectHandler.md +238 -63
  141. package/node_modules/undici/docs/docs/api/RetryAgent.md +113 -26
  142. package/node_modules/undici/docs/docs/api/RetryHandler.md +161 -77
  143. package/node_modules/undici/docs/docs/api/RoundRobinPool.md +166 -72
  144. package/node_modules/undici/docs/docs/api/SnapshotAgent.md +264 -542
  145. package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +162 -186
  146. package/node_modules/undici/docs/docs/api/Util.md +68 -11
  147. package/node_modules/undici/docs/docs/api/WebSocket.md +475 -80
  148. package/node_modules/undici/docs/docs/api/api-lifecycle.md +100 -32
  149. package/node_modules/undici/docs/docs/best-practices/client-certificate.md +2 -0
  150. package/node_modules/undici/docs/docs/best-practices/crawling.md +3 -1
  151. package/node_modules/undici/docs/docs/best-practices/migrating-from-v7-to-v8.md +6 -4
  152. package/node_modules/undici/docs/docs/best-practices/mocking-request.md +9 -7
  153. package/node_modules/undici/docs/docs/best-practices/proxy.md +3 -1
  154. package/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +10 -8
  155. package/node_modules/undici/docs/docs/best-practices/writing-tests.md +2 -0
  156. package/node_modules/undici/docs/docs/{GettingStarted.md → getting-started.md} +22 -19
  157. package/node_modules/undici/docs/docs/index.md +779 -0
  158. package/node_modules/undici/docs/docs/site.json +125 -0
  159. package/node_modules/undici/docs/docs/type-map.json +79 -0
  160. package/node_modules/undici/lib/api/api-request.js +7 -1
  161. package/node_modules/undici/lib/api/readable.js +47 -2
  162. package/node_modules/undici/lib/core/errors.js +20 -0
  163. package/node_modules/undici/lib/core/request.js +1 -1
  164. package/node_modules/undici/lib/core/util.js +24 -1
  165. package/node_modules/undici/lib/dispatcher/client-h1.js +92 -1
  166. package/node_modules/undici/lib/dispatcher/client-h2.js +322 -118
  167. package/node_modules/undici/lib/dispatcher/client.js +6 -2
  168. package/node_modules/undici/lib/dispatcher/dispatcher-base.js +1 -0
  169. package/node_modules/undici/lib/dispatcher/proxy-agent.js +42 -7
  170. package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +4 -2
  171. package/node_modules/undici/lib/handler/redirect-handler.js +1 -0
  172. package/node_modules/undici/lib/handler/retry-handler.js +57 -19
  173. package/node_modules/undici/lib/util/cache.js +8 -2
  174. package/node_modules/undici/lib/web/cookies/parse.js +20 -27
  175. package/node_modules/undici/lib/web/cookies/util.js +1 -1
  176. package/node_modules/undici/lib/web/eventsource/eventsource.js +7 -18
  177. package/node_modules/undici/lib/web/eventsource/util.js +32 -1
  178. package/node_modules/undici/lib/web/fetch/body.js +43 -0
  179. package/node_modules/undici/lib/web/fetch/constants.js +1 -1
  180. package/node_modules/undici/lib/web/fetch/index.js +11 -2
  181. package/node_modules/undici/lib/web/fetch/request.js +1 -0
  182. package/node_modules/undici/lib/web/fetch/util.js +4 -1
  183. package/node_modules/undici/lib/web/websocket/receiver.js +20 -3
  184. package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -1
  185. package/node_modules/undici/lib/web/websocket/websocket.js +3 -1
  186. package/node_modules/undici/package.json +1 -1
  187. package/node_modules/undici/types/client.d.ts +6 -1
  188. package/node_modules/undici/types/cookies.d.ts +1 -1
  189. package/node_modules/undici/types/errors.d.ts +10 -0
  190. package/node_modules/undici/types/fetch.d.ts +1 -0
  191. package/node_modules/undici/types/handlers.d.ts +2 -0
  192. package/node_modules/undici/types/proxy-agent.d.ts +7 -0
  193. package/package.json +4 -4
  194. package/react/styles.css +510 -5
  195. package/react/styles.source.css +850 -0
  196. package/node_modules/hono/dist/tsconfig.build.tsbuildinfo +0 -1
  197. package/node_modules/tailwindcss/dist/chunk-XVOTX5KS.mjs +0 -1
@@ -0,0 +1,779 @@
1
+ # undici
2
+
3
+ <!--type=misc-->
4
+
5
+ [![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)
6
+
7
+ An HTTP/1.1 client, written from scratch for Node.js.
8
+
9
+ > Undici means eleven in Italian. 1.1 -> 11 -> Eleven -> Undici.
10
+ It is also a Stranger Things reference.
11
+
12
+ ## How to get involved
13
+
14
+ 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.
15
+
16
+ Looking to contribute? Start by reading the [contributing guide](./CONTRIBUTING.md)
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ npm i undici
22
+ ```
23
+
24
+ ## Benchmarks
25
+
26
+ The benchmark is a simple getting data [example](https://github.com/nodejs/undici/blob/main/benchmarks/benchmark.js) using
27
+ 50 TCP connections with a pipelining depth of 10 running on Node 24.14.1.
28
+
29
+ ### HTTP/1.1
30
+
31
+ ```text
32
+ ┌────────────────────────┬─────────┬────────────────────┬────────────┬─────────────────────────┐
33
+ │ Tests │ Samples │ Result │ Tolerance │ Difference with slowest │
34
+ ├────────────────────────┼─────────┼────────────────────┼────────────┼─────────────────────────┤
35
+ │ 'node-fetch' │ 50 │ '4711.86 req/sec' │ '± 2.92 %' │ '-' │
36
+ │ 'undici - fetch' │ 75 │ '5438.50 req/sec' │ '± 2.97 %' │ '+ 15.42 %' │
37
+ │ 'axios' │ 45 │ '5448.08 req/sec' │ '± 2.98 %' │ '+ 15.62 %' │
38
+ │ 'request' │ 65 │ '5809.63 req/sec' │ '± 2.90 %' │ '+ 23.30 %' │
39
+ │ 'http - no keepalive' │ 35 │ '5910.77 req/sec' │ '± 2.87 %' │ '+ 25.44 %' │
40
+ │ 'got' │ 50 │ '6047.80 req/sec' │ '± 2.91 %' │ '+ 28.35 %' │
41
+ │ 'superagent' │ 60 │ '7534.53 req/sec' │ '± 2.97 %' │ '+ 59.91 %' │
42
+ │ 'http - keepalive' │ 75 │ '9343.41 req/sec' │ '± 2.90 %' │ '+ 98.30 %' │
43
+ │ 'undici - pipeline' │ 65 │ '13470.70 req/sec' │ '± 2.93 %' │ '+ 185.89 %' │
44
+ │ 'undici - request' │ 80 │ '16850.87 req/sec' │ '± 2.93 %' │ '+ 257.63 %' │
45
+ │ 'undici - stream' │ 101 │ '18488.56 req/sec' │ '± 3.81 %' │ '+ 292.38 %' │
46
+ │ 'undici - dispatch' │ 101 │ '20786.44 req/sec' │ '± 3.08 %' │ '+ 341.15 %' │
47
+ └────────────────────────┴─────────┴────────────────────┴────────────┴─────────────────────────┘
48
+ ```
49
+
50
+ ### HTTP/1.1 over HTTPS
51
+
52
+ Using [benchmark-https.js](https://github.com/nodejs/undici/blob/main/benchmarks/benchmark-https.js) against an h1-over-TLS server (50 connections, pipelining depth 10, Node 24.14.1).
53
+
54
+ ```text
55
+ ┌────────────────────────┬─────────┬───────────────────┬────────────┬─────────────────────────┐
56
+ │ Tests │ Samples │ Result │ Tolerance │ Difference with slowest │
57
+ ├────────────────────────┼─────────┼───────────────────┼────────────┼─────────────────────────┤
58
+ │ 'https - no keepalive'│ 10 │ '1358.40 req/sec' │ '± 1.99 %' │ '-' │
59
+ │ 'undici - fetch' │ 30 │ '3721.76 req/sec' │ '± 2.97 %' │ '+ 173.98 %' │
60
+ │ 'https - keepalive' │ 35 │ '5633.91 req/sec' │ '± 2.84 %' │ '+ 314.75 %' │
61
+ │ 'undici - pipeline' │ 15 │ '6254.05 req/sec' │ '± 2.80 %' │ '+ 360.40 %' │
62
+ │ 'undici - request' │ 25 │ '6669.80 req/sec' │ '± 2.73 %' │ '+ 391.01 %' │
63
+ │ 'undici - stream' │ 25 │ '7019.04 req/sec' │ '± 2.77 %' │ '+ 416.71 %' │
64
+ │ 'undici - dispatch' │ 20 │ '7361.85 req/sec' │ '± 2.90 %' │ '+ 441.95 %' │
65
+ └────────────────────────┴─────────┴───────────────────┴────────────┴─────────────────────────┘
66
+ ```
67
+
68
+ ### HTTP/2
69
+
70
+ Using [benchmark-http2.js](https://github.com/nodejs/undici/blob/main/benchmarks/benchmark-http2.js) against an h2 server (50 connections, pipelining depth 10, Node 24.14.1).
71
+
72
+ ```text
73
+ ┌────────────────────────┬─────────┬───────────────────┬────────────┬─────────────────────────┐
74
+ │ Tests │ Samples │ Result │ Tolerance │ Difference with slowest │
75
+ ├────────────────────────┼─────────┼───────────────────┼────────────┼─────────────────────────┤
76
+ │ 'undici - fetch' │ 45 │ '3499.03 req/sec' │ '± 2.93 %' │ '-' │
77
+ │ 'native - http2' │ 25 │ '4904.58 req/sec' │ '± 2.81 %' │ '+ 40.17 %' │
78
+ │ 'undici - pipeline' │ 60 │ '5836.82 req/sec' │ '± 2.99 %' │ '+ 66.81 %' │
79
+ │ 'undici - request' │ 65 │ '6831.25 req/sec' │ '± 2.83 %' │ '+ 95.23 %' │
80
+ │ 'undici - stream' │ 55 │ '6874.30 req/sec' │ '± 2.91 %' │ '+ 96.46 %' │
81
+ │ 'undici - dispatch' │ 55 │ '7791.23 req/sec' │ '± 2.96 %' │ '+ 122.67 %' │
82
+ └────────────────────────┴─────────┴───────────────────┴────────────┴─────────────────────────┘
83
+ ```
84
+
85
+ ## Undici vs. Fetch
86
+
87
+ ### Overview
88
+
89
+ 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.
90
+
91
+ ### Built-in Fetch (Node.js v18+)
92
+
93
+ Node.js's built-in fetch is powered by a bundled version of undici:
94
+
95
+ ```js
96
+ // Available globally in Node.js v18+
97
+ const response = await fetch('https://api.example.com/data');
98
+ const data = await response.json();
99
+
100
+ // Check the bundled undici version
101
+ console.log(process.versions.undici); // e.g., "5.28.4"
102
+ ```
103
+
104
+ **Pros:**
105
+ - No additional dependencies required
106
+ - Works across different JavaScript runtimes
107
+ - Automatic compression handling (gzip, deflate, br)
108
+ - Built-in caching support (in development)
109
+
110
+ **Cons:**
111
+ - Limited to the undici version bundled with your Node.js version
112
+ - Less control over connection pooling and advanced features
113
+ - Error handling follows Web API standards (errors wrapped in `TypeError`)
114
+ - Performance overhead due to Web Streams implementation
115
+
116
+ ### Undici Module
117
+
118
+ Installing undici as a separate module gives you access to the latest features and APIs:
119
+
120
+ ```bash
121
+ npm install undici
122
+ ```
123
+
124
+ ```js
125
+ import { request, fetch, Agent, setGlobalDispatcher } from 'undici';
126
+
127
+ // Use undici.request for maximum performance
128
+ const { statusCode, headers, body } = await request('https://api.example.com/data');
129
+ const data = await body.json();
130
+
131
+ // Or use undici.fetch with custom configuration
132
+ const agent = new Agent({ keepAliveTimeout: 10000 });
133
+ setGlobalDispatcher(agent);
134
+ const response = await fetch('https://api.example.com/data');
135
+ ```
136
+
137
+ **Pros:**
138
+ - Latest undici features and bug fixes
139
+ - Access to advanced APIs (`request`, `stream`, `pipeline`)
140
+ - Fine-grained control over connection pooling
141
+ - Better error handling with clearer error messages
142
+ - Superior performance, especially with `undici.request`
143
+ - HTTP/1.1 pipelining support
144
+ - Custom interceptors and middleware
145
+ - Advanced features like `ProxyAgent`, `Socks5Agent`, `MockAgent`
146
+
147
+ **Cons:**
148
+ - Additional dependency to manage
149
+ - Larger bundle size
150
+
151
+ ### When to Use Each
152
+
153
+ #### Use Built-in Fetch When:
154
+ - You want zero dependencies
155
+ - Building isomorphic code that runs in browsers and Node.js
156
+ - Publishing to npm and want to maximize compatibility with JS runtimes
157
+ - Simple HTTP requests without advanced configuration
158
+ - You're publishing to npm and you want to maximize compatiblity
159
+ - You don't depend on features from a specific version of undici
160
+
161
+ #### Use Undici Module When:
162
+ - You need the latest undici features and performance improvements
163
+ - You require advanced connection pooling configuration
164
+ - You need APIs not available in the built-in fetch (`ProxyAgent`, `Socks5Agent`, `MockAgent`, etc.)
165
+ - Performance is critical (use `undici.request` for maximum speed)
166
+ - You want better error handling and debugging capabilities
167
+ - You need HTTP/1.1 pipelining or advanced interceptors
168
+ - You prefer decoupled protocol and API interfaces
169
+
170
+ ### Performance Comparison
171
+
172
+ Based on benchmarks, here's the typical performance hierarchy:
173
+
174
+ 1. **`undici.request()`** - Fastest, most efficient
175
+ 2. **`undici.fetch()`** - Good performance, standard compliance
176
+ 3. **Node.js `http`/`https`** - Baseline performance
177
+
178
+ ### Migration Guide
179
+
180
+ If you're currently using built-in fetch and want to migrate to undici:
181
+
182
+ ```js
183
+ // Before: Built-in fetch
184
+ const response = await fetch('https://api.example.com/data');
185
+
186
+ // After: Undici fetch (drop-in replacement)
187
+ import { fetch } from 'undici';
188
+ const response = await fetch('https://api.example.com/data');
189
+
190
+ // Or: Undici request (better performance)
191
+ import { request } from 'undici';
192
+ const { statusCode, body } = await request('https://api.example.com/data');
193
+ const data = await body.json();
194
+ ```
195
+
196
+ ### Keep `fetch` and `FormData` together
197
+
198
+ When you send a `FormData` body, keep `fetch` and `FormData` from the same
199
+ implementation.
200
+
201
+ Use one of these patterns:
202
+
203
+ ```js
204
+ // Built-in globals
205
+ const body = new FormData()
206
+ body.set('name', 'some')
207
+ await fetch('https://example.com', {
208
+ method: 'POST',
209
+ body
210
+ })
211
+ ```
212
+
213
+ ```js
214
+ // undici module imports
215
+ import { fetch, FormData } from 'undici'
216
+
217
+ const body = new FormData()
218
+ body.set('name', 'some')
219
+ await fetch('https://example.com', {
220
+ method: 'POST',
221
+ body
222
+ })
223
+ ```
224
+
225
+ If you want the installed `undici` package to provide the globals, call
226
+ `install()` first:
227
+
228
+ ```js
229
+ import { install } from 'undici'
230
+
231
+ install()
232
+
233
+ const body = new FormData()
234
+ body.set('name', 'some')
235
+ await fetch('https://example.com', {
236
+ method: 'POST',
237
+ body
238
+ })
239
+ ```
240
+
241
+ `install()` replaces the global `fetch`, `Headers`, `Response`, `Request`, and
242
+ `FormData` implementations with undici's versions, so they all match. It also
243
+ installs undici's `WebSocket`, `CloseEvent`, `ErrorEvent`, `MessageEvent`, and
244
+ `EventSource` globals.
245
+
246
+ Avoid mixing a global `FormData` with `undici.fetch()`, or `undici.FormData`
247
+ with the built-in global `fetch()`.
248
+
249
+ ### Version Compatibility
250
+
251
+ You can check which version of undici is bundled with your Node.js version:
252
+
253
+ ```js
254
+ console.log(process.versions.undici);
255
+ ```
256
+
257
+ 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.
258
+
259
+ ## Quick Start
260
+
261
+ ### Basic Request
262
+
263
+ ```js
264
+ import { request } from 'undici'
265
+
266
+ const {
267
+ statusCode,
268
+ headers,
269
+ trailers,
270
+ body
271
+ } = await request('http://localhost:3000/foo')
272
+
273
+ console.log('response received', statusCode)
274
+ console.log('headers', headers)
275
+
276
+ for await (const data of body) { console.log('data', data) }
277
+
278
+ console.log('trailers', trailers)
279
+ ```
280
+
281
+ ### Using Cache Interceptor
282
+
283
+ Undici provides a powerful HTTP caching interceptor that follows HTTP caching best practices. Here's how to use it:
284
+
285
+ ```js
286
+ import { fetch, Agent, interceptors, cacheStores } from 'undici';
287
+
288
+ // Create a client with cache interceptor
289
+ const client = new Agent().compose(interceptors.cache({
290
+ // Optional: Configure cache store (defaults to MemoryCacheStore)
291
+ store: new cacheStores.MemoryCacheStore({
292
+ maxSize: 100 * 1024 * 1024, // 100MB
293
+ maxCount: 1000,
294
+ maxEntrySize: 5 * 1024 * 1024 // 5MB
295
+ }),
296
+
297
+ // Optional: Specify which HTTP methods to cache (default: ['GET', 'HEAD'])
298
+ methods: ['GET', 'HEAD']
299
+ }));
300
+
301
+ // Set the global dispatcher to use our caching client
302
+ setGlobalDispatcher(client);
303
+
304
+ // Now all fetch requests will use the cache
305
+ async function getData() {
306
+ const response = await fetch('https://api.example.com/data');
307
+ // The server should set appropriate Cache-Control headers in the response
308
+ // which the cache will respect based on the cache policy
309
+ return response.json();
310
+ }
311
+
312
+ // First request - fetches from origin
313
+ const data1 = await getData();
314
+
315
+ // Second request - served from cache if within max-age
316
+ const data2 = await getData();
317
+ ```
318
+
319
+ #### Key Features:
320
+ - **Automatic Caching**: Respects `Cache-Control` and `Expires` headers
321
+ - **Validation**: Supports `ETag` and `Last-Modified` validation
322
+ - **Storage Options**: In-memory or persistent SQLite storage
323
+ - **Flexible**: Configure cache size, TTL, and more
324
+
325
+ ## Global Installation
326
+
327
+ Undici provides an `install()` function to add fetch-related and other web API classes to `globalThis`, making them available globally:
328
+
329
+ ```js
330
+ import { install } from 'undici'
331
+
332
+ // Install undici's global web APIs
333
+ install()
334
+
335
+ // Now you can use fetch classes globally without importing
336
+ const response = await fetch('https://api.example.com/data')
337
+ const data = await response.json()
338
+
339
+ // All classes are available globally:
340
+ const headers = new Headers([['content-type', 'application/json']])
341
+ const request = new Request('https://example.com')
342
+ const formData = new FormData()
343
+ const ws = new WebSocket('wss://example.com')
344
+ const eventSource = new EventSource('https://example.com/events')
345
+ ```
346
+
347
+ The `install()` function adds the following classes to `globalThis`:
348
+
349
+ - `fetch` - The fetch function
350
+ - `Headers` - HTTP headers management
351
+ - `Response` - HTTP response representation
352
+ - `Request` - HTTP request representation
353
+ - `FormData` - Form data handling
354
+ - `WebSocket` - WebSocket client
355
+ - `CloseEvent`, `ErrorEvent`, `MessageEvent` - WebSocket events
356
+ - `EventSource` - Server-sent events client
357
+
358
+ When you call `install()`, these globals come from the same undici
359
+ implementation. For example, global `fetch` and global `FormData` will both be
360
+ undici's versions, and `WebSocket` and `EventSource` will also come from
361
+ undici, which is the recommended setup if you want to use undici through
362
+ globals.
363
+
364
+ This is useful for:
365
+ - Polyfilling environments that don't have fetch
366
+ - Ensuring consistent fetch behavior across different Node.js versions
367
+ - Making undici's implementations available globally for libraries that expect them
368
+
369
+ ## Body Mixins
370
+
371
+ The `body` mixins are the most common way to format the request/response body. Mixins include:
372
+
373
+ - [`.arrayBuffer()`](https://fetch.spec.whatwg.org/#dom-body-arraybuffer)
374
+ - [`.blob()`](https://fetch.spec.whatwg.org/#dom-body-blob)
375
+ - [`.bytes()`](https://fetch.spec.whatwg.org/#dom-body-bytes)
376
+ - [`.json()`](https://fetch.spec.whatwg.org/#dom-body-json)
377
+ - [`.text()`](https://fetch.spec.whatwg.org/#dom-body-text)
378
+
379
+ > [!NOTE]
380
+ > The body returned from `undici.request` does not implement `.formData()`.
381
+
382
+ > [!WARNING]
383
+ > Calling `body.formData()` on a fetch response causes undici to buffer and parse the entire body. Since this is dictated by the spec, `body.formData()` must only be called on responses from trusted servers.
384
+
385
+ Example usage:
386
+
387
+ ```js
388
+ import { request } from 'undici'
389
+
390
+ const {
391
+ statusCode,
392
+ headers,
393
+ trailers,
394
+ body
395
+ } = await request('http://localhost:3000/foo')
396
+
397
+ console.log('response received', statusCode)
398
+ console.log('headers', headers)
399
+ console.log('data', await body.json())
400
+ console.log('trailers', trailers)
401
+ ```
402
+
403
+ _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._
404
+
405
+ 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.
406
+
407
+ For more information about their behavior, please reference the body mixin from the [Fetch Standard](https://fetch.spec.whatwg.org/#body-mixin).
408
+
409
+ ## Common API Methods
410
+
411
+ 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.
412
+
413
+ ### `undici.request([url, options])`
414
+
415
+ * `url` {string|URL|UrlObject}
416
+ * `options` {RequestOptions} See [`RequestOptions`](./docs/docs/api/Dispatcher.md#parameter-requestoptions).
417
+ * `dispatcher` {Dispatcher} **Default:** [getGlobalDispatcher](#undicigetglobaldispatcher).
418
+ * `method` {string} **Default:** `PUT` if `options.body`, otherwise `GET`.
419
+ * Returns: {Promise} A promise with the result of the `Dispatcher.request` method.
420
+
421
+ Calls `options.dispatcher.request(options)`.
422
+
423
+ See [Dispatcher.request](./docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback) for more details, and [request examples](./docs/examples/README.md) for examples.
424
+
425
+ ### `undici.stream([url, options, ]factory)`
426
+
427
+ * `url` {string|URL|UrlObject}
428
+ * `options` {StreamOptions} See [`StreamOptions`](./docs/docs/api/Dispatcher.md#parameter-streamoptions).
429
+ * `dispatcher` {Dispatcher} **Default:** [getGlobalDispatcher](#undicigetglobaldispatcher).
430
+ * `method` {string} **Default:** `PUT` if `options.body`, otherwise `GET`.
431
+ * `factory` {Function} `Dispatcher.stream.factory`.
432
+ * Returns: {Promise} A promise with the result of the `Dispatcher.stream` method.
433
+
434
+ Calls `options.dispatcher.stream(options, factory)`.
435
+
436
+ See [Dispatcher.stream](./docs/docs/api/Dispatcher.md#dispatcherstreamoptions-factory-callback) for more details.
437
+
438
+ ### `undici.pipeline([url, options, ]handler)`
439
+
440
+ * `url` {string|URL|UrlObject}
441
+ * `options` {PipelineOptions} See [`PipelineOptions`](./docs/docs/api/Dispatcher.md#parameter-pipelineoptions).
442
+ * `dispatcher` {Dispatcher} **Default:** [getGlobalDispatcher](#undicigetglobaldispatcher).
443
+ * `method` {string} **Default:** `PUT` if `options.body`, otherwise `GET`.
444
+ * `handler` {Function} `Dispatcher.pipeline.handler`.
445
+ * Returns: {Duplex} A `stream.Duplex`.
446
+
447
+ Calls `options.dispatch.pipeline(options, handler)`.
448
+
449
+ See [Dispatcher.pipeline](./docs/docs/api/Dispatcher.md#dispatcherpipelineoptions-handler) for more details.
450
+
451
+ ### `undici.connect([url, options])`
452
+
453
+ Starts two-way communications with the requested resource using [HTTP CONNECT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/CONNECT).
454
+
455
+ * `url` {string|URL|UrlObject}
456
+ * `options` {ConnectOptions} See [`ConnectOptions`](./docs/docs/api/Dispatcher.md#parameter-connectoptions).
457
+ * `dispatcher` {Dispatcher} **Default:** [getGlobalDispatcher](#undicigetglobaldispatcher).
458
+ * `callback` {Function} (optional) — `(err, data) => void`.
459
+ * Returns: {Promise} A promise with the result of the `Dispatcher.connect` method.
460
+
461
+ Calls `options.dispatch.connect(options)`.
462
+
463
+ See [Dispatcher.connect](./docs/docs/api/Dispatcher.md#dispatcherconnectoptions-callback) for more details.
464
+
465
+ ### `undici.fetch(input[, init])`
466
+
467
+ Implements [fetch](https://fetch.spec.whatwg.org/#fetch-method).
468
+
469
+ * https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch
470
+ * https://fetch.spec.whatwg.org/#fetch-method
471
+
472
+ Basic usage example:
473
+
474
+ ```js
475
+ import { fetch } from 'undici'
476
+
477
+
478
+ const res = await fetch('https://example.com')
479
+ const json = await res.json()
480
+ console.log(json)
481
+ ```
482
+
483
+ You can pass an optional dispatcher to `fetch` as:
484
+
485
+ ```js
486
+ import { fetch, Agent } from 'undici'
487
+
488
+ const res = await fetch('https://example.com', {
489
+ // Mocks are also supported
490
+ dispatcher: new Agent({
491
+ keepAliveTimeout: 10,
492
+ keepAliveMaxTimeout: 10
493
+ })
494
+ })
495
+ const json = await res.json()
496
+ console.log(json)
497
+ ```
498
+
499
+ #### `request.body`
500
+
501
+ A body can be of the following types:
502
+
503
+ - ArrayBuffer
504
+ - ArrayBufferView
505
+ - AsyncIterables
506
+ - Blob
507
+ - Iterables
508
+ - String
509
+ - URLSearchParams
510
+ - FormData
511
+
512
+ In this implementation of fetch, ```request.body``` now accepts ```Async Iterables```. It is not present in the [Fetch Standard](https://fetch.spec.whatwg.org).
513
+
514
+ ```js
515
+ import { fetch } from 'undici'
516
+
517
+ const data = {
518
+ async *[Symbol.asyncIterator]() {
519
+ yield 'hello'
520
+ yield 'world'
521
+ },
522
+ }
523
+
524
+ await fetch('https://example.com', { body: data, method: 'POST', duplex: 'half' })
525
+ ```
526
+
527
+ [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:
528
+
529
+ ```js
530
+ import { openAsBlob } from 'node:fs'
531
+
532
+ const file = await openAsBlob('./big.csv')
533
+ const body = new FormData()
534
+ body.set('file', file, 'big.csv')
535
+
536
+ await fetch('http://example.com', { method: 'POST', body })
537
+ ```
538
+
539
+ #### `request.duplex`
540
+
541
+ - `'half'`
542
+
543
+ 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).
544
+
545
+ #### `response.body`
546
+
547
+ 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()`.
548
+
549
+ ```js
550
+ import { fetch } from 'undici'
551
+ import { Readable } from 'node:stream'
552
+
553
+ const response = await fetch('https://example.com')
554
+ const readableWebStream = response.body
555
+ const readableNodeStream = Readable.fromWeb(readableWebStream)
556
+ ```
557
+
558
+ ## Specification Compliance
559
+
560
+ 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
561
+ not support or does not fully implement.
562
+
563
+ #### CORS
564
+
565
+ Unlike browsers, Undici does not implement CORS (Cross-Origin Resource Sharing) checks by default. This means:
566
+
567
+ - No preflight requests are automatically sent for cross-origin requests
568
+ - No validation of `Access-Control-Allow-Origin` headers is performed
569
+ - Requests to any origin are allowed regardless of the source
570
+
571
+ 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.
572
+
573
+ #### Garbage Collection
574
+
575
+ * https://fetch.spec.whatwg.org/#garbage-collection
576
+
577
+ The [Fetch Standard](https://fetch.spec.whatwg.org) allows users to skip consuming the response body by relying on
578
+ [garbage collection](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management#garbage_collection) to release connection resources.
579
+
580
+ Garbage collection in Node is less aggressive and deterministic
581
+ (due to the lack of clear idle periods that browsers have through the rendering refresh rate)
582
+ which means that leaving the release of connection resources to the garbage collector can lead
583
+ to excessive connection usage, reduced performance (due to less connection re-use), and even
584
+ stalls or deadlocks when running out of connections.
585
+ Therefore, __it is important to always either consume or cancel the response body anyway__.
586
+
587
+ ```js
588
+ // Do
589
+ const { body, headers } = await fetch(url);
590
+ for await (const chunk of body) {
591
+ // force consumption of body
592
+ }
593
+
594
+ // Do not
595
+ const { headers } = await fetch(url);
596
+ ```
597
+
598
+ 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.
599
+
600
+ ```js
601
+ const headers = await fetch(url, { method: 'HEAD' })
602
+ .then(res => res.headers)
603
+ ```
604
+
605
+ Note that consuming the response body is _mandatory_ for `request`:
606
+
607
+ ```js
608
+ // Do
609
+ const { body, headers } = await request(url);
610
+ await body.dump(); // force consumption of body
611
+
612
+ // Do not
613
+ const { headers } = await request(url);
614
+ ```
615
+
616
+ #### Forbidden and Safelisted Header Names
617
+
618
+ * https://fetch.spec.whatwg.org/#cors-safelisted-response-header-name
619
+ * https://fetch.spec.whatwg.org/#forbidden-header-name
620
+ * https://fetch.spec.whatwg.org/#forbidden-response-header-name
621
+ * https://github.com/wintercg/fetch/issues/6
622
+
623
+ 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.
624
+
625
+ #### Content-Encoding
626
+
627
+ * https://www.rfc-editor.org/rfc/rfc9110#field.content-encoding
628
+
629
+ 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).
630
+
631
+ #### `undici.upgrade([url, options])`
632
+
633
+ 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.
634
+
635
+ * `url` {string|URL|UrlObject}
636
+ * `options` {UpgradeOptions} See [`UpgradeOptions`](./docs/docs/api/Dispatcher.md#parameter-upgradeoptions).
637
+ * `dispatcher` {Dispatcher} **Default:** [getGlobalDispatcher](#undicigetglobaldispatcher).
638
+ * `callback` {Function} (optional) — `(error, data) => void`.
639
+ * Returns: {Promise} A promise with the result of the `Dispatcher.upgrade` method.
640
+
641
+ Calls `options.dispatcher.upgrade(options)`.
642
+
643
+ See [Dispatcher.upgrade](./docs/docs/api/Dispatcher.md#dispatcherupgradeoptions-callback) for more details.
644
+
645
+ ### `undici.setGlobalDispatcher(dispatcher)`
646
+
647
+ * `dispatcher` {Dispatcher}
648
+
649
+ Sets the global dispatcher used by Common API Methods. Global dispatcher is shared among compatible undici modules,
650
+ including undici that is bundled internally with node.js.
651
+
652
+ Undici stores this dispatcher under `Symbol.for('undici.globalDispatcher.2')`.
653
+
654
+ `setGlobalDispatcher()` also mirrors the configured dispatcher to
655
+ `Symbol.for('undici.globalDispatcher.1')` using `Dispatcher1Wrapper`, so Node.js built-in `fetch`
656
+ can keep using the legacy handler contract while Undici uses the new handler API.
657
+
658
+ ### `undici.getGlobalDispatcher()`
659
+
660
+ Gets the global dispatcher used by Common API Methods.
661
+
662
+ * Returns: {Dispatcher}
663
+
664
+ ### `undici.setGlobalOrigin(origin)`
665
+
666
+ * `origin` {string|URL|undefined}
667
+
668
+ Sets the global origin used in `fetch`.
669
+
670
+ 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.
671
+
672
+ ```js
673
+ setGlobalOrigin('http://localhost:3000')
674
+
675
+ const response = await fetch('/api/ping')
676
+
677
+ console.log(response.url) // http://localhost:3000/api/ping
678
+ ```
679
+
680
+ ### `undici.getGlobalOrigin()`
681
+
682
+ Gets the global origin used in `fetch`.
683
+
684
+ * Returns: {URL}
685
+
686
+ ### `UrlObject`
687
+
688
+ * `port` {string|number} (optional)
689
+ * `path` {string} (optional)
690
+ * `pathname` {string} (optional)
691
+ * `hostname` {string} (optional)
692
+ * `origin` {string} (optional)
693
+ * `protocol` {string} (optional)
694
+ * `search` {string} (optional)
695
+
696
+ #### Expect
697
+
698
+ Undici does not support the `Expect` request header field. The request
699
+ body is always immediately sent and the `100 Continue` response will be
700
+ ignored.
701
+
702
+ Refs: https://tools.ietf.org/html/rfc7231#section-5.1.1
703
+
704
+ #### Pipelining
705
+
706
+ Undici will only use pipelining if configured with a `pipelining` factor
707
+ greater than `1`. Only enable pipelining when the remote server is trusted.
708
+ Also it is important to pass `blocking: false` to the request options to
709
+ properly pipeline requests.
710
+
711
+ Undici always assumes that connections are persistent and will immediately
712
+ pipeline requests, without checking whether the connection is persistent.
713
+ Hence, automatic fallback to HTTP/1.0 or HTTP/1.1 without pipelining is
714
+ not supported.
715
+
716
+ Undici will immediately pipeline when retrying requests after a failed
717
+ connection. However, Undici will not retry the first remaining requests in
718
+ the prior pipeline and instead error the corresponding callback/promise/stream.
719
+
720
+ Undici will abort all running requests in the pipeline when any of them are
721
+ aborted.
722
+
723
+ * Refs: https://tools.ietf.org/html/rfc2616#section-8.1.2.2
724
+ * Refs: https://tools.ietf.org/html/rfc7230#section-6.3.2
725
+
726
+ #### Manual Redirect
727
+
728
+ Since it is not possible to manually follow an HTTP redirect on the server-side,
729
+ Undici returns the actual response instead of an `opaqueredirect` filtered one
730
+ when invoked with a `manual` redirect. This aligns `fetch()` with the other
731
+ implementations in Deno and Cloudflare Workers.
732
+
733
+ Refs: https://fetch.spec.whatwg.org/#atomic-http-redirect-handling
734
+
735
+ ### Workarounds
736
+
737
+ #### Network address family autoselection.
738
+
739
+ If you experience problem when connecting to a remote server that is resolved by your DNS servers to a IPv6 (AAAA record)
740
+ first, there are chances that your local router or ISP might have problem connecting to IPv6 networks. In that case
741
+ undici will throw an error with code `UND_ERR_CONNECT_TIMEOUT`.
742
+
743
+ If the target server resolves to both a IPv6 and IPv4 (A records) address and you are using a compatible Node version
744
+ (18.3.0 and above), you can fix the problem by providing the `autoSelectFamily` option (support by both `undici.request`
745
+ and `undici.Agent`) which will enable the family autoselection algorithm when establishing the connection.
746
+
747
+ ## Collaborators
748
+
749
+ * [__Daniele Belardi__](https://github.com/dnlup), <https://www.npmjs.com/~dnlup>
750
+ * [__Ethan Arrowood__](https://github.com/ethan-arrowood), <https://www.npmjs.com/~ethan_arrowood>
751
+ * [__Matteo Collina__](https://github.com/mcollina), <https://www.npmjs.com/~matteo.collina>
752
+ * [__Matthew Aitken__](https://github.com/KhafraDev), <https://www.npmjs.com/~khaf>
753
+ * [__Robert Nagy__](https://github.com/ronag), <https://www.npmjs.com/~ronag>
754
+ * [__Szymon Marczak__](https://github.com/szmarczak), <https://www.npmjs.com/~szmarczak>
755
+
756
+ ## Past Collaborators
757
+ * [__Tomas Della Vedova__](https://github.com/delvedor), <https://www.npmjs.com/~delvedor>
758
+
759
+ ### Releasers
760
+
761
+ * [__Ethan Arrowood__](https://github.com/ethan-arrowood), <https://www.npmjs.com/~ethan_arrowood>
762
+ * [__Matteo Collina__](https://github.com/mcollina), <https://www.npmjs.com/~matteo.collina>
763
+ * [__Robert Nagy__](https://github.com/ronag), <https://www.npmjs.com/~ronag>
764
+ * [__Matthew Aitken__](https://github.com/KhafraDev), <https://www.npmjs.com/~khaf>
765
+
766
+ ## Long Term Support
767
+
768
+ Undici aligns with the Node.js LTS schedule. The following table shows the supported versions:
769
+
770
+ | Undici Version | Bundled in Node.js | Node.js Versions Supported | End of Life |
771
+ |----------------|--------------------|----------------------------|-------------|
772
+ | 5.x | 18.x | ≥14.0 (tested: 14, 16, 18) | 2024-04-30 |
773
+ | 6.x | 20.x, 22.x | ≥18.17 (tested: 18, 20, 21, 22) | 2027-04-30 |
774
+ | 7.x | 24.x | ≥20.18.1 (tested: 20, 22, 24) | 2028-04-30 |
775
+ | 8.x | 26.x | ≥22.19.0 (tested: 22, 24, 26) | 2029-04-30 |
776
+
777
+ ## License
778
+
779
+ MIT