coupeeeez 0.0.1

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 (881) hide show
  1. package/LICENSE.MD +7 -0
  2. package/command +18 -0
  3. package/makeApp.ts +17 -0
  4. package/package.json +41 -0
  5. package/stream-api/Message.ts +6 -0
  6. package/stream-api/SSEInjected.ts +3 -0
  7. package/stream-api/SSEServer.ts +37 -0
  8. package/stream-api/SSEServers.ts +36 -0
  9. package/stream-api/StreamApi.ts +39 -0
  10. package/stream-api/app.ts +14 -0
  11. package/stream-api/index.ts +1 -0
  12. package/stream-api/node_modules/.package-lock.json +971 -0
  13. package/stream-api/node_modules/@types/body-parser/LICENSE +21 -0
  14. package/stream-api/node_modules/@types/body-parser/README.md +15 -0
  15. package/stream-api/node_modules/@types/body-parser/index.d.ts +95 -0
  16. package/stream-api/node_modules/@types/body-parser/package.json +64 -0
  17. package/stream-api/node_modules/@types/connect/LICENSE +21 -0
  18. package/stream-api/node_modules/@types/connect/README.md +15 -0
  19. package/stream-api/node_modules/@types/connect/index.d.ts +91 -0
  20. package/stream-api/node_modules/@types/connect/package.json +32 -0
  21. package/stream-api/node_modules/@types/express/LICENSE +21 -0
  22. package/stream-api/node_modules/@types/express/README.md +15 -0
  23. package/stream-api/node_modules/@types/express/index.d.ts +122 -0
  24. package/stream-api/node_modules/@types/express/package.json +45 -0
  25. package/stream-api/node_modules/@types/express-serve-static-core/LICENSE +21 -0
  26. package/stream-api/node_modules/@types/express-serve-static-core/README.md +15 -0
  27. package/stream-api/node_modules/@types/express-serve-static-core/index.d.ts +1244 -0
  28. package/stream-api/node_modules/@types/express-serve-static-core/package.json +51 -0
  29. package/stream-api/node_modules/@types/http-errors/LICENSE +21 -0
  30. package/stream-api/node_modules/@types/http-errors/README.md +15 -0
  31. package/stream-api/node_modules/@types/http-errors/index.d.ts +77 -0
  32. package/stream-api/node_modules/@types/http-errors/package.json +36 -0
  33. package/stream-api/node_modules/@types/mime/LICENSE +21 -0
  34. package/stream-api/node_modules/@types/mime/Mime.d.ts +10 -0
  35. package/stream-api/node_modules/@types/mime/README.md +15 -0
  36. package/stream-api/node_modules/@types/mime/index.d.ts +31 -0
  37. package/stream-api/node_modules/@types/mime/lite.d.ts +7 -0
  38. package/stream-api/node_modules/@types/mime/package.json +30 -0
  39. package/stream-api/node_modules/@types/node/LICENSE +21 -0
  40. package/stream-api/node_modules/@types/node/README.md +15 -0
  41. package/stream-api/node_modules/@types/node/assert/strict.d.ts +111 -0
  42. package/stream-api/node_modules/@types/node/assert.d.ts +1115 -0
  43. package/stream-api/node_modules/@types/node/async_hooks.d.ts +623 -0
  44. package/stream-api/node_modules/@types/node/buffer.buffer.d.ts +472 -0
  45. package/stream-api/node_modules/@types/node/buffer.d.ts +1934 -0
  46. package/stream-api/node_modules/@types/node/child_process.d.ts +1476 -0
  47. package/stream-api/node_modules/@types/node/cluster.d.ts +578 -0
  48. package/stream-api/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  49. package/stream-api/node_modules/@types/node/console.d.ts +453 -0
  50. package/stream-api/node_modules/@types/node/constants.d.ts +21 -0
  51. package/stream-api/node_modules/@types/node/crypto.d.ts +5417 -0
  52. package/stream-api/node_modules/@types/node/dgram.d.ts +600 -0
  53. package/stream-api/node_modules/@types/node/diagnostics_channel.d.ts +576 -0
  54. package/stream-api/node_modules/@types/node/dns/promises.d.ts +503 -0
  55. package/stream-api/node_modules/@types/node/dns.d.ts +923 -0
  56. package/stream-api/node_modules/@types/node/domain.d.ts +170 -0
  57. package/stream-api/node_modules/@types/node/events.d.ts +976 -0
  58. package/stream-api/node_modules/@types/node/fs/promises.d.ts +1317 -0
  59. package/stream-api/node_modules/@types/node/fs.d.ts +4714 -0
  60. package/stream-api/node_modules/@types/node/globals.d.ts +170 -0
  61. package/stream-api/node_modules/@types/node/globals.typedarray.d.ts +41 -0
  62. package/stream-api/node_modules/@types/node/http.d.ts +2134 -0
  63. package/stream-api/node_modules/@types/node/http2.d.ts +2756 -0
  64. package/stream-api/node_modules/@types/node/https.d.ts +579 -0
  65. package/stream-api/node_modules/@types/node/index.d.ts +101 -0
  66. package/stream-api/node_modules/@types/node/inspector.d.ts +277 -0
  67. package/stream-api/node_modules/@types/node/inspector.generated.d.ts +4233 -0
  68. package/stream-api/node_modules/@types/node/module.d.ts +894 -0
  69. package/stream-api/node_modules/@types/node/net.d.ts +1054 -0
  70. package/stream-api/node_modules/@types/node/os.d.ts +507 -0
  71. package/stream-api/node_modules/@types/node/package.json +155 -0
  72. package/stream-api/node_modules/@types/node/path.d.ts +200 -0
  73. package/stream-api/node_modules/@types/node/perf_hooks.d.ts +982 -0
  74. package/stream-api/node_modules/@types/node/process.d.ts +2069 -0
  75. package/stream-api/node_modules/@types/node/punycode.d.ts +117 -0
  76. package/stream-api/node_modules/@types/node/querystring.d.ts +152 -0
  77. package/stream-api/node_modules/@types/node/readline/promises.d.ts +161 -0
  78. package/stream-api/node_modules/@types/node/readline.d.ts +594 -0
  79. package/stream-api/node_modules/@types/node/repl.d.ts +438 -0
  80. package/stream-api/node_modules/@types/node/sea.d.ts +162 -0
  81. package/stream-api/node_modules/@types/node/sqlite.d.ts +937 -0
  82. package/stream-api/node_modules/@types/node/stream/consumers.d.ts +38 -0
  83. package/stream-api/node_modules/@types/node/stream/promises.d.ts +90 -0
  84. package/stream-api/node_modules/@types/node/stream/web.d.ts +573 -0
  85. package/stream-api/node_modules/@types/node/stream.d.ts +1683 -0
  86. package/stream-api/node_modules/@types/node/string_decoder.d.ts +67 -0
  87. package/stream-api/node_modules/@types/node/test.d.ts +2339 -0
  88. package/stream-api/node_modules/@types/node/timers/promises.d.ts +108 -0
  89. package/stream-api/node_modules/@types/node/timers.d.ts +285 -0
  90. package/stream-api/node_modules/@types/node/tls.d.ts +1269 -0
  91. package/stream-api/node_modules/@types/node/trace_events.d.ts +197 -0
  92. package/stream-api/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
  93. package/stream-api/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  94. package/stream-api/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  95. package/stream-api/node_modules/@types/node/ts5.6/index.d.ts +103 -0
  96. package/stream-api/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  97. package/stream-api/node_modules/@types/node/ts5.7/index.d.ts +103 -0
  98. package/stream-api/node_modules/@types/node/tty.d.ts +208 -0
  99. package/stream-api/node_modules/@types/node/url.d.ts +1057 -0
  100. package/stream-api/node_modules/@types/node/util.d.ts +2325 -0
  101. package/stream-api/node_modules/@types/node/v8.d.ts +952 -0
  102. package/stream-api/node_modules/@types/node/vm.d.ts +1180 -0
  103. package/stream-api/node_modules/@types/node/wasi.d.ts +202 -0
  104. package/stream-api/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  105. package/stream-api/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
  106. package/stream-api/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  107. package/stream-api/node_modules/@types/node/web-globals/events.d.ts +97 -0
  108. package/stream-api/node_modules/@types/node/web-globals/fetch.d.ts +50 -0
  109. package/stream-api/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  110. package/stream-api/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  111. package/stream-api/node_modules/@types/node/web-globals/streams.d.ts +22 -0
  112. package/stream-api/node_modules/@types/node/worker_threads.d.ts +896 -0
  113. package/stream-api/node_modules/@types/node/zlib.d.ts +681 -0
  114. package/stream-api/node_modules/@types/qs/LICENSE +21 -0
  115. package/stream-api/node_modules/@types/qs/README.md +15 -0
  116. package/stream-api/node_modules/@types/qs/index.d.ts +82 -0
  117. package/stream-api/node_modules/@types/qs/package.json +66 -0
  118. package/stream-api/node_modules/@types/range-parser/LICENSE +21 -0
  119. package/stream-api/node_modules/@types/range-parser/README.md +53 -0
  120. package/stream-api/node_modules/@types/range-parser/index.d.ts +34 -0
  121. package/stream-api/node_modules/@types/range-parser/package.json +25 -0
  122. package/stream-api/node_modules/@types/send/LICENSE +21 -0
  123. package/stream-api/node_modules/@types/send/README.md +15 -0
  124. package/stream-api/node_modules/@types/send/index.d.ts +187 -0
  125. package/stream-api/node_modules/@types/send/package.json +38 -0
  126. package/stream-api/node_modules/@types/serve-static/LICENSE +21 -0
  127. package/stream-api/node_modules/@types/serve-static/README.md +15 -0
  128. package/stream-api/node_modules/@types/serve-static/index.d.ts +107 -0
  129. package/stream-api/node_modules/@types/serve-static/node_modules/@types/send/LICENSE +21 -0
  130. package/stream-api/node_modules/@types/serve-static/node_modules/@types/send/README.md +15 -0
  131. package/stream-api/node_modules/@types/serve-static/node_modules/@types/send/index.d.ts +225 -0
  132. package/stream-api/node_modules/@types/serve-static/node_modules/@types/send/package.json +39 -0
  133. package/stream-api/node_modules/@types/serve-static/package.json +45 -0
  134. package/stream-api/node_modules/accepts/HISTORY.md +250 -0
  135. package/stream-api/node_modules/accepts/LICENSE +23 -0
  136. package/stream-api/node_modules/accepts/README.md +140 -0
  137. package/stream-api/node_modules/accepts/index.js +238 -0
  138. package/stream-api/node_modules/accepts/package.json +47 -0
  139. package/stream-api/node_modules/any-base/LICENSE +21 -0
  140. package/stream-api/node_modules/any-base/README.md +55 -0
  141. package/stream-api/node_modules/any-base/dist/any-base.js +94 -0
  142. package/stream-api/node_modules/any-base/dist/any-base.min.js +1 -0
  143. package/stream-api/node_modules/any-base/index.js +30 -0
  144. package/stream-api/node_modules/any-base/package.json +40 -0
  145. package/stream-api/node_modules/any-base/src/converter.js +80 -0
  146. package/stream-api/node_modules/body-parser/LICENSE +23 -0
  147. package/stream-api/node_modules/body-parser/README.md +494 -0
  148. package/stream-api/node_modules/body-parser/index.js +80 -0
  149. package/stream-api/node_modules/body-parser/lib/read.js +250 -0
  150. package/stream-api/node_modules/body-parser/lib/types/json.js +166 -0
  151. package/stream-api/node_modules/body-parser/lib/types/raw.js +43 -0
  152. package/stream-api/node_modules/body-parser/lib/types/text.js +37 -0
  153. package/stream-api/node_modules/body-parser/lib/types/urlencoded.js +142 -0
  154. package/stream-api/node_modules/body-parser/lib/utils.js +96 -0
  155. package/stream-api/node_modules/body-parser/package.json +52 -0
  156. package/stream-api/node_modules/bytes/History.md +97 -0
  157. package/stream-api/node_modules/bytes/LICENSE +23 -0
  158. package/stream-api/node_modules/bytes/Readme.md +152 -0
  159. package/stream-api/node_modules/bytes/index.js +170 -0
  160. package/stream-api/node_modules/bytes/package.json +42 -0
  161. package/stream-api/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
  162. package/stream-api/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
  163. package/stream-api/node_modules/call-bind-apply-helpers/.nycrc +9 -0
  164. package/stream-api/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
  165. package/stream-api/node_modules/call-bind-apply-helpers/LICENSE +21 -0
  166. package/stream-api/node_modules/call-bind-apply-helpers/README.md +62 -0
  167. package/stream-api/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
  168. package/stream-api/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
  169. package/stream-api/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
  170. package/stream-api/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
  171. package/stream-api/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
  172. package/stream-api/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
  173. package/stream-api/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
  174. package/stream-api/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
  175. package/stream-api/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
  176. package/stream-api/node_modules/call-bind-apply-helpers/index.js +15 -0
  177. package/stream-api/node_modules/call-bind-apply-helpers/package.json +85 -0
  178. package/stream-api/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
  179. package/stream-api/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
  180. package/stream-api/node_modules/call-bind-apply-helpers/test/index.js +63 -0
  181. package/stream-api/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
  182. package/stream-api/node_modules/call-bound/.eslintrc +13 -0
  183. package/stream-api/node_modules/call-bound/.github/FUNDING.yml +12 -0
  184. package/stream-api/node_modules/call-bound/.nycrc +9 -0
  185. package/stream-api/node_modules/call-bound/CHANGELOG.md +42 -0
  186. package/stream-api/node_modules/call-bound/LICENSE +21 -0
  187. package/stream-api/node_modules/call-bound/README.md +53 -0
  188. package/stream-api/node_modules/call-bound/index.d.ts +94 -0
  189. package/stream-api/node_modules/call-bound/index.js +19 -0
  190. package/stream-api/node_modules/call-bound/package.json +99 -0
  191. package/stream-api/node_modules/call-bound/test/index.js +61 -0
  192. package/stream-api/node_modules/call-bound/tsconfig.json +10 -0
  193. package/stream-api/node_modules/commander/LICENSE +22 -0
  194. package/stream-api/node_modules/commander/Readme.md +1159 -0
  195. package/stream-api/node_modules/commander/esm.mjs +16 -0
  196. package/stream-api/node_modules/commander/index.js +24 -0
  197. package/stream-api/node_modules/commander/lib/argument.js +150 -0
  198. package/stream-api/node_modules/commander/lib/command.js +2777 -0
  199. package/stream-api/node_modules/commander/lib/error.js +39 -0
  200. package/stream-api/node_modules/commander/lib/help.js +747 -0
  201. package/stream-api/node_modules/commander/lib/option.js +380 -0
  202. package/stream-api/node_modules/commander/lib/suggestSimilar.js +101 -0
  203. package/stream-api/node_modules/commander/package-support.json +16 -0
  204. package/stream-api/node_modules/commander/package.json +82 -0
  205. package/stream-api/node_modules/commander/typings/esm.d.mts +3 -0
  206. package/stream-api/node_modules/commander/typings/index.d.ts +1113 -0
  207. package/stream-api/node_modules/content-disposition/HISTORY.md +72 -0
  208. package/stream-api/node_modules/content-disposition/LICENSE +22 -0
  209. package/stream-api/node_modules/content-disposition/README.md +142 -0
  210. package/stream-api/node_modules/content-disposition/index.js +458 -0
  211. package/stream-api/node_modules/content-disposition/package.json +43 -0
  212. package/stream-api/node_modules/content-type/HISTORY.md +29 -0
  213. package/stream-api/node_modules/content-type/LICENSE +22 -0
  214. package/stream-api/node_modules/content-type/README.md +94 -0
  215. package/stream-api/node_modules/content-type/index.js +225 -0
  216. package/stream-api/node_modules/content-type/package.json +42 -0
  217. package/stream-api/node_modules/cookie/LICENSE +24 -0
  218. package/stream-api/node_modules/cookie/README.md +317 -0
  219. package/stream-api/node_modules/cookie/SECURITY.md +25 -0
  220. package/stream-api/node_modules/cookie/index.js +335 -0
  221. package/stream-api/node_modules/cookie/package.json +44 -0
  222. package/stream-api/node_modules/cookie-signature/History.md +70 -0
  223. package/stream-api/node_modules/cookie-signature/LICENSE +22 -0
  224. package/stream-api/node_modules/cookie-signature/Readme.md +23 -0
  225. package/stream-api/node_modules/cookie-signature/index.js +47 -0
  226. package/stream-api/node_modules/cookie-signature/package.json +24 -0
  227. package/stream-api/node_modules/debug/LICENSE +20 -0
  228. package/stream-api/node_modules/debug/README.md +481 -0
  229. package/stream-api/node_modules/debug/package.json +64 -0
  230. package/stream-api/node_modules/debug/src/browser.js +272 -0
  231. package/stream-api/node_modules/debug/src/common.js +292 -0
  232. package/stream-api/node_modules/debug/src/index.js +10 -0
  233. package/stream-api/node_modules/debug/src/node.js +263 -0
  234. package/stream-api/node_modules/depd/History.md +103 -0
  235. package/stream-api/node_modules/depd/LICENSE +22 -0
  236. package/stream-api/node_modules/depd/Readme.md +280 -0
  237. package/stream-api/node_modules/depd/index.js +538 -0
  238. package/stream-api/node_modules/depd/lib/browser/index.js +77 -0
  239. package/stream-api/node_modules/depd/package.json +45 -0
  240. package/stream-api/node_modules/dunder-proto/.eslintrc +5 -0
  241. package/stream-api/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
  242. package/stream-api/node_modules/dunder-proto/.nycrc +13 -0
  243. package/stream-api/node_modules/dunder-proto/CHANGELOG.md +24 -0
  244. package/stream-api/node_modules/dunder-proto/LICENSE +21 -0
  245. package/stream-api/node_modules/dunder-proto/README.md +54 -0
  246. package/stream-api/node_modules/dunder-proto/get.d.ts +5 -0
  247. package/stream-api/node_modules/dunder-proto/get.js +30 -0
  248. package/stream-api/node_modules/dunder-proto/package.json +76 -0
  249. package/stream-api/node_modules/dunder-proto/set.d.ts +5 -0
  250. package/stream-api/node_modules/dunder-proto/set.js +35 -0
  251. package/stream-api/node_modules/dunder-proto/test/get.js +34 -0
  252. package/stream-api/node_modules/dunder-proto/test/index.js +4 -0
  253. package/stream-api/node_modules/dunder-proto/test/set.js +50 -0
  254. package/stream-api/node_modules/dunder-proto/tsconfig.json +9 -0
  255. package/stream-api/node_modules/ee-first/LICENSE +22 -0
  256. package/stream-api/node_modules/ee-first/README.md +80 -0
  257. package/stream-api/node_modules/ee-first/index.js +95 -0
  258. package/stream-api/node_modules/ee-first/package.json +29 -0
  259. package/stream-api/node_modules/encodeurl/LICENSE +22 -0
  260. package/stream-api/node_modules/encodeurl/README.md +109 -0
  261. package/stream-api/node_modules/encodeurl/index.js +60 -0
  262. package/stream-api/node_modules/encodeurl/package.json +40 -0
  263. package/stream-api/node_modules/es-define-property/.eslintrc +13 -0
  264. package/stream-api/node_modules/es-define-property/.github/FUNDING.yml +12 -0
  265. package/stream-api/node_modules/es-define-property/.nycrc +9 -0
  266. package/stream-api/node_modules/es-define-property/CHANGELOG.md +29 -0
  267. package/stream-api/node_modules/es-define-property/LICENSE +21 -0
  268. package/stream-api/node_modules/es-define-property/README.md +49 -0
  269. package/stream-api/node_modules/es-define-property/index.d.ts +3 -0
  270. package/stream-api/node_modules/es-define-property/index.js +14 -0
  271. package/stream-api/node_modules/es-define-property/package.json +81 -0
  272. package/stream-api/node_modules/es-define-property/test/index.js +56 -0
  273. package/stream-api/node_modules/es-define-property/tsconfig.json +10 -0
  274. package/stream-api/node_modules/es-errors/.eslintrc +5 -0
  275. package/stream-api/node_modules/es-errors/.github/FUNDING.yml +12 -0
  276. package/stream-api/node_modules/es-errors/CHANGELOG.md +40 -0
  277. package/stream-api/node_modules/es-errors/LICENSE +21 -0
  278. package/stream-api/node_modules/es-errors/README.md +55 -0
  279. package/stream-api/node_modules/es-errors/eval.d.ts +3 -0
  280. package/stream-api/node_modules/es-errors/eval.js +4 -0
  281. package/stream-api/node_modules/es-errors/index.d.ts +3 -0
  282. package/stream-api/node_modules/es-errors/index.js +4 -0
  283. package/stream-api/node_modules/es-errors/package.json +80 -0
  284. package/stream-api/node_modules/es-errors/range.d.ts +3 -0
  285. package/stream-api/node_modules/es-errors/range.js +4 -0
  286. package/stream-api/node_modules/es-errors/ref.d.ts +3 -0
  287. package/stream-api/node_modules/es-errors/ref.js +4 -0
  288. package/stream-api/node_modules/es-errors/syntax.d.ts +3 -0
  289. package/stream-api/node_modules/es-errors/syntax.js +4 -0
  290. package/stream-api/node_modules/es-errors/test/index.js +19 -0
  291. package/stream-api/node_modules/es-errors/tsconfig.json +49 -0
  292. package/stream-api/node_modules/es-errors/type.d.ts +3 -0
  293. package/stream-api/node_modules/es-errors/type.js +4 -0
  294. package/stream-api/node_modules/es-errors/uri.d.ts +3 -0
  295. package/stream-api/node_modules/es-errors/uri.js +4 -0
  296. package/stream-api/node_modules/es-object-atoms/.eslintrc +16 -0
  297. package/stream-api/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
  298. package/stream-api/node_modules/es-object-atoms/CHANGELOG.md +37 -0
  299. package/stream-api/node_modules/es-object-atoms/LICENSE +21 -0
  300. package/stream-api/node_modules/es-object-atoms/README.md +63 -0
  301. package/stream-api/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
  302. package/stream-api/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
  303. package/stream-api/node_modules/es-object-atoms/ToObject.d.ts +7 -0
  304. package/stream-api/node_modules/es-object-atoms/ToObject.js +10 -0
  305. package/stream-api/node_modules/es-object-atoms/index.d.ts +3 -0
  306. package/stream-api/node_modules/es-object-atoms/index.js +4 -0
  307. package/stream-api/node_modules/es-object-atoms/isObject.d.ts +3 -0
  308. package/stream-api/node_modules/es-object-atoms/isObject.js +6 -0
  309. package/stream-api/node_modules/es-object-atoms/package.json +80 -0
  310. package/stream-api/node_modules/es-object-atoms/test/index.js +38 -0
  311. package/stream-api/node_modules/es-object-atoms/tsconfig.json +6 -0
  312. package/stream-api/node_modules/escape-html/LICENSE +24 -0
  313. package/stream-api/node_modules/escape-html/Readme.md +43 -0
  314. package/stream-api/node_modules/escape-html/index.js +78 -0
  315. package/stream-api/node_modules/escape-html/package.json +24 -0
  316. package/stream-api/node_modules/etag/HISTORY.md +83 -0
  317. package/stream-api/node_modules/etag/LICENSE +22 -0
  318. package/stream-api/node_modules/etag/README.md +159 -0
  319. package/stream-api/node_modules/etag/index.js +131 -0
  320. package/stream-api/node_modules/etag/package.json +47 -0
  321. package/stream-api/node_modules/express/History.md +3858 -0
  322. package/stream-api/node_modules/express/LICENSE +24 -0
  323. package/stream-api/node_modules/express/Readme.md +266 -0
  324. package/stream-api/node_modules/express/index.js +11 -0
  325. package/stream-api/node_modules/express/lib/application.js +631 -0
  326. package/stream-api/node_modules/express/lib/express.js +81 -0
  327. package/stream-api/node_modules/express/lib/request.js +515 -0
  328. package/stream-api/node_modules/express/lib/response.js +1039 -0
  329. package/stream-api/node_modules/express/lib/utils.js +269 -0
  330. package/stream-api/node_modules/express/lib/view.js +205 -0
  331. package/stream-api/node_modules/express/package.json +98 -0
  332. package/stream-api/node_modules/finalhandler/HISTORY.md +233 -0
  333. package/stream-api/node_modules/finalhandler/LICENSE +22 -0
  334. package/stream-api/node_modules/finalhandler/README.md +147 -0
  335. package/stream-api/node_modules/finalhandler/index.js +293 -0
  336. package/stream-api/node_modules/finalhandler/package.json +43 -0
  337. package/stream-api/node_modules/forwarded/HISTORY.md +21 -0
  338. package/stream-api/node_modules/forwarded/LICENSE +22 -0
  339. package/stream-api/node_modules/forwarded/README.md +57 -0
  340. package/stream-api/node_modules/forwarded/index.js +90 -0
  341. package/stream-api/node_modules/forwarded/package.json +45 -0
  342. package/stream-api/node_modules/fresh/HISTORY.md +80 -0
  343. package/stream-api/node_modules/fresh/LICENSE +23 -0
  344. package/stream-api/node_modules/fresh/README.md +117 -0
  345. package/stream-api/node_modules/fresh/index.js +136 -0
  346. package/stream-api/node_modules/fresh/package.json +46 -0
  347. package/stream-api/node_modules/function-bind/.eslintrc +21 -0
  348. package/stream-api/node_modules/function-bind/.github/FUNDING.yml +12 -0
  349. package/stream-api/node_modules/function-bind/.github/SECURITY.md +3 -0
  350. package/stream-api/node_modules/function-bind/.nycrc +13 -0
  351. package/stream-api/node_modules/function-bind/CHANGELOG.md +136 -0
  352. package/stream-api/node_modules/function-bind/LICENSE +20 -0
  353. package/stream-api/node_modules/function-bind/README.md +46 -0
  354. package/stream-api/node_modules/function-bind/implementation.js +84 -0
  355. package/stream-api/node_modules/function-bind/index.js +5 -0
  356. package/stream-api/node_modules/function-bind/package.json +87 -0
  357. package/stream-api/node_modules/function-bind/test/.eslintrc +9 -0
  358. package/stream-api/node_modules/function-bind/test/index.js +252 -0
  359. package/stream-api/node_modules/get-intrinsic/.eslintrc +42 -0
  360. package/stream-api/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
  361. package/stream-api/node_modules/get-intrinsic/.nycrc +9 -0
  362. package/stream-api/node_modules/get-intrinsic/CHANGELOG.md +186 -0
  363. package/stream-api/node_modules/get-intrinsic/LICENSE +21 -0
  364. package/stream-api/node_modules/get-intrinsic/README.md +71 -0
  365. package/stream-api/node_modules/get-intrinsic/index.js +378 -0
  366. package/stream-api/node_modules/get-intrinsic/package.json +97 -0
  367. package/stream-api/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
  368. package/stream-api/node_modules/get-proto/.eslintrc +10 -0
  369. package/stream-api/node_modules/get-proto/.github/FUNDING.yml +12 -0
  370. package/stream-api/node_modules/get-proto/.nycrc +9 -0
  371. package/stream-api/node_modules/get-proto/CHANGELOG.md +21 -0
  372. package/stream-api/node_modules/get-proto/LICENSE +21 -0
  373. package/stream-api/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
  374. package/stream-api/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
  375. package/stream-api/node_modules/get-proto/README.md +50 -0
  376. package/stream-api/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
  377. package/stream-api/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
  378. package/stream-api/node_modules/get-proto/index.d.ts +5 -0
  379. package/stream-api/node_modules/get-proto/index.js +27 -0
  380. package/stream-api/node_modules/get-proto/package.json +81 -0
  381. package/stream-api/node_modules/get-proto/test/index.js +68 -0
  382. package/stream-api/node_modules/get-proto/tsconfig.json +9 -0
  383. package/stream-api/node_modules/gopd/.eslintrc +16 -0
  384. package/stream-api/node_modules/gopd/.github/FUNDING.yml +12 -0
  385. package/stream-api/node_modules/gopd/CHANGELOG.md +45 -0
  386. package/stream-api/node_modules/gopd/LICENSE +21 -0
  387. package/stream-api/node_modules/gopd/README.md +40 -0
  388. package/stream-api/node_modules/gopd/gOPD.d.ts +1 -0
  389. package/stream-api/node_modules/gopd/gOPD.js +4 -0
  390. package/stream-api/node_modules/gopd/index.d.ts +5 -0
  391. package/stream-api/node_modules/gopd/index.js +15 -0
  392. package/stream-api/node_modules/gopd/package.json +77 -0
  393. package/stream-api/node_modules/gopd/test/index.js +36 -0
  394. package/stream-api/node_modules/gopd/tsconfig.json +9 -0
  395. package/stream-api/node_modules/has-symbols/.eslintrc +11 -0
  396. package/stream-api/node_modules/has-symbols/.github/FUNDING.yml +12 -0
  397. package/stream-api/node_modules/has-symbols/.nycrc +9 -0
  398. package/stream-api/node_modules/has-symbols/CHANGELOG.md +91 -0
  399. package/stream-api/node_modules/has-symbols/LICENSE +21 -0
  400. package/stream-api/node_modules/has-symbols/README.md +46 -0
  401. package/stream-api/node_modules/has-symbols/index.d.ts +3 -0
  402. package/stream-api/node_modules/has-symbols/index.js +14 -0
  403. package/stream-api/node_modules/has-symbols/package.json +111 -0
  404. package/stream-api/node_modules/has-symbols/shams.d.ts +3 -0
  405. package/stream-api/node_modules/has-symbols/shams.js +45 -0
  406. package/stream-api/node_modules/has-symbols/test/index.js +22 -0
  407. package/stream-api/node_modules/has-symbols/test/shams/core-js.js +29 -0
  408. package/stream-api/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
  409. package/stream-api/node_modules/has-symbols/test/tests.js +58 -0
  410. package/stream-api/node_modules/has-symbols/tsconfig.json +10 -0
  411. package/stream-api/node_modules/hasown/.eslintrc +5 -0
  412. package/stream-api/node_modules/hasown/.github/FUNDING.yml +12 -0
  413. package/stream-api/node_modules/hasown/.nycrc +13 -0
  414. package/stream-api/node_modules/hasown/CHANGELOG.md +40 -0
  415. package/stream-api/node_modules/hasown/LICENSE +21 -0
  416. package/stream-api/node_modules/hasown/README.md +40 -0
  417. package/stream-api/node_modules/hasown/index.d.ts +3 -0
  418. package/stream-api/node_modules/hasown/index.js +8 -0
  419. package/stream-api/node_modules/hasown/package.json +92 -0
  420. package/stream-api/node_modules/hasown/tsconfig.json +6 -0
  421. package/stream-api/node_modules/http-errors/HISTORY.md +186 -0
  422. package/stream-api/node_modules/http-errors/LICENSE +23 -0
  423. package/stream-api/node_modules/http-errors/README.md +169 -0
  424. package/stream-api/node_modules/http-errors/index.js +290 -0
  425. package/stream-api/node_modules/http-errors/package.json +54 -0
  426. package/stream-api/node_modules/iconv-lite/Changelog.md +236 -0
  427. package/stream-api/node_modules/iconv-lite/LICENSE +21 -0
  428. package/stream-api/node_modules/iconv-lite/README.md +138 -0
  429. package/stream-api/node_modules/iconv-lite/encodings/dbcs-codec.js +532 -0
  430. package/stream-api/node_modules/iconv-lite/encodings/dbcs-data.js +185 -0
  431. package/stream-api/node_modules/iconv-lite/encodings/index.js +23 -0
  432. package/stream-api/node_modules/iconv-lite/encodings/internal.js +218 -0
  433. package/stream-api/node_modules/iconv-lite/encodings/sbcs-codec.js +75 -0
  434. package/stream-api/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
  435. package/stream-api/node_modules/iconv-lite/encodings/sbcs-data.js +178 -0
  436. package/stream-api/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
  437. package/stream-api/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
  438. package/stream-api/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
  439. package/stream-api/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
  440. package/stream-api/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
  441. package/stream-api/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
  442. package/stream-api/node_modules/iconv-lite/encodings/tables/gbk-added.json +56 -0
  443. package/stream-api/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
  444. package/stream-api/node_modules/iconv-lite/encodings/utf16.js +187 -0
  445. package/stream-api/node_modules/iconv-lite/encodings/utf32.js +307 -0
  446. package/stream-api/node_modules/iconv-lite/encodings/utf7.js +283 -0
  447. package/stream-api/node_modules/iconv-lite/lib/bom-handling.js +48 -0
  448. package/stream-api/node_modules/iconv-lite/lib/helpers/merge-exports.js +13 -0
  449. package/stream-api/node_modules/iconv-lite/lib/index.d.ts +41 -0
  450. package/stream-api/node_modules/iconv-lite/lib/index.js +183 -0
  451. package/stream-api/node_modules/iconv-lite/lib/streams.js +105 -0
  452. package/stream-api/node_modules/iconv-lite/package.json +59 -0
  453. package/stream-api/node_modules/inherits/LICENSE +16 -0
  454. package/stream-api/node_modules/inherits/README.md +42 -0
  455. package/stream-api/node_modules/inherits/inherits.js +9 -0
  456. package/stream-api/node_modules/inherits/inherits_browser.js +27 -0
  457. package/stream-api/node_modules/inherits/package.json +29 -0
  458. package/stream-api/node_modules/ipaddr.js/LICENSE +19 -0
  459. package/stream-api/node_modules/ipaddr.js/README.md +233 -0
  460. package/stream-api/node_modules/ipaddr.js/ipaddr.min.js +1 -0
  461. package/stream-api/node_modules/ipaddr.js/lib/ipaddr.js +673 -0
  462. package/stream-api/node_modules/ipaddr.js/lib/ipaddr.js.d.ts +68 -0
  463. package/stream-api/node_modules/ipaddr.js/package.json +35 -0
  464. package/stream-api/node_modules/is-promise/LICENSE +19 -0
  465. package/stream-api/node_modules/is-promise/index.d.ts +2 -0
  466. package/stream-api/node_modules/is-promise/index.js +6 -0
  467. package/stream-api/node_modules/is-promise/index.mjs +3 -0
  468. package/stream-api/node_modules/is-promise/package.json +30 -0
  469. package/stream-api/node_modules/is-promise/readme.md +33 -0
  470. package/stream-api/node_modules/math-intrinsics/.eslintrc +16 -0
  471. package/stream-api/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
  472. package/stream-api/node_modules/math-intrinsics/CHANGELOG.md +24 -0
  473. package/stream-api/node_modules/math-intrinsics/LICENSE +21 -0
  474. package/stream-api/node_modules/math-intrinsics/README.md +50 -0
  475. package/stream-api/node_modules/math-intrinsics/abs.d.ts +1 -0
  476. package/stream-api/node_modules/math-intrinsics/abs.js +4 -0
  477. package/stream-api/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
  478. package/stream-api/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
  479. package/stream-api/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
  480. package/stream-api/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
  481. package/stream-api/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
  482. package/stream-api/node_modules/math-intrinsics/constants/maxValue.js +5 -0
  483. package/stream-api/node_modules/math-intrinsics/floor.d.ts +1 -0
  484. package/stream-api/node_modules/math-intrinsics/floor.js +4 -0
  485. package/stream-api/node_modules/math-intrinsics/isFinite.d.ts +3 -0
  486. package/stream-api/node_modules/math-intrinsics/isFinite.js +12 -0
  487. package/stream-api/node_modules/math-intrinsics/isInteger.d.ts +3 -0
  488. package/stream-api/node_modules/math-intrinsics/isInteger.js +16 -0
  489. package/stream-api/node_modules/math-intrinsics/isNaN.d.ts +1 -0
  490. package/stream-api/node_modules/math-intrinsics/isNaN.js +6 -0
  491. package/stream-api/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
  492. package/stream-api/node_modules/math-intrinsics/isNegativeZero.js +6 -0
  493. package/stream-api/node_modules/math-intrinsics/max.d.ts +1 -0
  494. package/stream-api/node_modules/math-intrinsics/max.js +4 -0
  495. package/stream-api/node_modules/math-intrinsics/min.d.ts +1 -0
  496. package/stream-api/node_modules/math-intrinsics/min.js +4 -0
  497. package/stream-api/node_modules/math-intrinsics/mod.d.ts +3 -0
  498. package/stream-api/node_modules/math-intrinsics/mod.js +9 -0
  499. package/stream-api/node_modules/math-intrinsics/package.json +86 -0
  500. package/stream-api/node_modules/math-intrinsics/pow.d.ts +1 -0
  501. package/stream-api/node_modules/math-intrinsics/pow.js +4 -0
  502. package/stream-api/node_modules/math-intrinsics/round.d.ts +1 -0
  503. package/stream-api/node_modules/math-intrinsics/round.js +4 -0
  504. package/stream-api/node_modules/math-intrinsics/sign.d.ts +3 -0
  505. package/stream-api/node_modules/math-intrinsics/sign.js +11 -0
  506. package/stream-api/node_modules/math-intrinsics/test/index.js +192 -0
  507. package/stream-api/node_modules/math-intrinsics/tsconfig.json +3 -0
  508. package/stream-api/node_modules/media-typer/HISTORY.md +50 -0
  509. package/stream-api/node_modules/media-typer/LICENSE +22 -0
  510. package/stream-api/node_modules/media-typer/README.md +93 -0
  511. package/stream-api/node_modules/media-typer/index.js +143 -0
  512. package/stream-api/node_modules/media-typer/package.json +33 -0
  513. package/stream-api/node_modules/merge-descriptors/index.d.ts +11 -0
  514. package/stream-api/node_modules/merge-descriptors/index.js +26 -0
  515. package/stream-api/node_modules/merge-descriptors/license +11 -0
  516. package/stream-api/node_modules/merge-descriptors/package.json +50 -0
  517. package/stream-api/node_modules/merge-descriptors/readme.md +55 -0
  518. package/stream-api/node_modules/mime-db/HISTORY.md +541 -0
  519. package/stream-api/node_modules/mime-db/LICENSE +23 -0
  520. package/stream-api/node_modules/mime-db/README.md +109 -0
  521. package/stream-api/node_modules/mime-db/db.json +9342 -0
  522. package/stream-api/node_modules/mime-db/index.js +12 -0
  523. package/stream-api/node_modules/mime-db/package.json +56 -0
  524. package/stream-api/node_modules/mime-types/HISTORY.md +428 -0
  525. package/stream-api/node_modules/mime-types/LICENSE +23 -0
  526. package/stream-api/node_modules/mime-types/README.md +126 -0
  527. package/stream-api/node_modules/mime-types/index.js +211 -0
  528. package/stream-api/node_modules/mime-types/mimeScore.js +57 -0
  529. package/stream-api/node_modules/mime-types/package.json +49 -0
  530. package/stream-api/node_modules/ms/index.js +162 -0
  531. package/stream-api/node_modules/ms/license.md +21 -0
  532. package/stream-api/node_modules/ms/package.json +38 -0
  533. package/stream-api/node_modules/ms/readme.md +59 -0
  534. package/stream-api/node_modules/negotiator/HISTORY.md +114 -0
  535. package/stream-api/node_modules/negotiator/LICENSE +24 -0
  536. package/stream-api/node_modules/negotiator/README.md +212 -0
  537. package/stream-api/node_modules/negotiator/index.js +83 -0
  538. package/stream-api/node_modules/negotiator/lib/charset.js +169 -0
  539. package/stream-api/node_modules/negotiator/lib/encoding.js +205 -0
  540. package/stream-api/node_modules/negotiator/lib/language.js +179 -0
  541. package/stream-api/node_modules/negotiator/lib/mediaType.js +294 -0
  542. package/stream-api/node_modules/negotiator/package.json +43 -0
  543. package/stream-api/node_modules/object-inspect/.eslintrc +53 -0
  544. package/stream-api/node_modules/object-inspect/.github/FUNDING.yml +12 -0
  545. package/stream-api/node_modules/object-inspect/.nycrc +13 -0
  546. package/stream-api/node_modules/object-inspect/CHANGELOG.md +424 -0
  547. package/stream-api/node_modules/object-inspect/LICENSE +21 -0
  548. package/stream-api/node_modules/object-inspect/example/all.js +23 -0
  549. package/stream-api/node_modules/object-inspect/example/circular.js +6 -0
  550. package/stream-api/node_modules/object-inspect/example/fn.js +5 -0
  551. package/stream-api/node_modules/object-inspect/example/inspect.js +10 -0
  552. package/stream-api/node_modules/object-inspect/index.js +544 -0
  553. package/stream-api/node_modules/object-inspect/package-support.json +20 -0
  554. package/stream-api/node_modules/object-inspect/package.json +105 -0
  555. package/stream-api/node_modules/object-inspect/readme.markdown +84 -0
  556. package/stream-api/node_modules/object-inspect/test/bigint.js +58 -0
  557. package/stream-api/node_modules/object-inspect/test/browser/dom.js +15 -0
  558. package/stream-api/node_modules/object-inspect/test/circular.js +16 -0
  559. package/stream-api/node_modules/object-inspect/test/deep.js +12 -0
  560. package/stream-api/node_modules/object-inspect/test/element.js +53 -0
  561. package/stream-api/node_modules/object-inspect/test/err.js +48 -0
  562. package/stream-api/node_modules/object-inspect/test/fakes.js +29 -0
  563. package/stream-api/node_modules/object-inspect/test/fn.js +76 -0
  564. package/stream-api/node_modules/object-inspect/test/global.js +17 -0
  565. package/stream-api/node_modules/object-inspect/test/has.js +15 -0
  566. package/stream-api/node_modules/object-inspect/test/holes.js +15 -0
  567. package/stream-api/node_modules/object-inspect/test/indent-option.js +271 -0
  568. package/stream-api/node_modules/object-inspect/test/inspect.js +139 -0
  569. package/stream-api/node_modules/object-inspect/test/lowbyte.js +12 -0
  570. package/stream-api/node_modules/object-inspect/test/number.js +58 -0
  571. package/stream-api/node_modules/object-inspect/test/quoteStyle.js +26 -0
  572. package/stream-api/node_modules/object-inspect/test/toStringTag.js +40 -0
  573. package/stream-api/node_modules/object-inspect/test/undef.js +12 -0
  574. package/stream-api/node_modules/object-inspect/test/values.js +261 -0
  575. package/stream-api/node_modules/object-inspect/test-core-js.js +26 -0
  576. package/stream-api/node_modules/object-inspect/util.inspect.js +1 -0
  577. package/stream-api/node_modules/on-finished/HISTORY.md +98 -0
  578. package/stream-api/node_modules/on-finished/LICENSE +23 -0
  579. package/stream-api/node_modules/on-finished/README.md +162 -0
  580. package/stream-api/node_modules/on-finished/index.js +234 -0
  581. package/stream-api/node_modules/on-finished/package.json +39 -0
  582. package/stream-api/node_modules/once/LICENSE +15 -0
  583. package/stream-api/node_modules/once/README.md +79 -0
  584. package/stream-api/node_modules/once/once.js +42 -0
  585. package/stream-api/node_modules/once/package.json +33 -0
  586. package/stream-api/node_modules/parseurl/HISTORY.md +58 -0
  587. package/stream-api/node_modules/parseurl/LICENSE +24 -0
  588. package/stream-api/node_modules/parseurl/README.md +133 -0
  589. package/stream-api/node_modules/parseurl/index.js +158 -0
  590. package/stream-api/node_modules/parseurl/package.json +40 -0
  591. package/stream-api/node_modules/path-to-regexp/LICENSE +21 -0
  592. package/stream-api/node_modules/path-to-regexp/Readme.md +224 -0
  593. package/stream-api/node_modules/path-to-regexp/dist/index.d.ts +144 -0
  594. package/stream-api/node_modules/path-to-regexp/dist/index.js +409 -0
  595. package/stream-api/node_modules/path-to-regexp/dist/index.js.map +1 -0
  596. package/stream-api/node_modules/path-to-regexp/package.json +64 -0
  597. package/stream-api/node_modules/proxy-addr/HISTORY.md +161 -0
  598. package/stream-api/node_modules/proxy-addr/LICENSE +22 -0
  599. package/stream-api/node_modules/proxy-addr/README.md +139 -0
  600. package/stream-api/node_modules/proxy-addr/index.js +327 -0
  601. package/stream-api/node_modules/proxy-addr/package.json +47 -0
  602. package/stream-api/node_modules/qs/.editorconfig +46 -0
  603. package/stream-api/node_modules/qs/.eslintrc +39 -0
  604. package/stream-api/node_modules/qs/.github/FUNDING.yml +12 -0
  605. package/stream-api/node_modules/qs/.nycrc +13 -0
  606. package/stream-api/node_modules/qs/CHANGELOG.md +622 -0
  607. package/stream-api/node_modules/qs/LICENSE.md +29 -0
  608. package/stream-api/node_modules/qs/README.md +733 -0
  609. package/stream-api/node_modules/qs/dist/qs.js +141 -0
  610. package/stream-api/node_modules/qs/lib/formats.js +23 -0
  611. package/stream-api/node_modules/qs/lib/index.js +11 -0
  612. package/stream-api/node_modules/qs/lib/parse.js +328 -0
  613. package/stream-api/node_modules/qs/lib/stringify.js +356 -0
  614. package/stream-api/node_modules/qs/lib/utils.js +268 -0
  615. package/stream-api/node_modules/qs/package.json +93 -0
  616. package/stream-api/node_modules/qs/test/empty-keys-cases.js +267 -0
  617. package/stream-api/node_modules/qs/test/parse.js +1276 -0
  618. package/stream-api/node_modules/qs/test/stringify.js +1306 -0
  619. package/stream-api/node_modules/qs/test/utils.js +262 -0
  620. package/stream-api/node_modules/range-parser/HISTORY.md +56 -0
  621. package/stream-api/node_modules/range-parser/LICENSE +23 -0
  622. package/stream-api/node_modules/range-parser/README.md +84 -0
  623. package/stream-api/node_modules/range-parser/index.js +162 -0
  624. package/stream-api/node_modules/range-parser/package.json +44 -0
  625. package/stream-api/node_modules/raw-body/LICENSE +22 -0
  626. package/stream-api/node_modules/raw-body/README.md +223 -0
  627. package/stream-api/node_modules/raw-body/index.d.ts +85 -0
  628. package/stream-api/node_modules/raw-body/index.js +336 -0
  629. package/stream-api/node_modules/raw-body/package.json +46 -0
  630. package/stream-api/node_modules/router/HISTORY.md +228 -0
  631. package/stream-api/node_modules/router/LICENSE +23 -0
  632. package/stream-api/node_modules/router/README.md +416 -0
  633. package/stream-api/node_modules/router/index.js +748 -0
  634. package/stream-api/node_modules/router/lib/layer.js +247 -0
  635. package/stream-api/node_modules/router/lib/route.js +242 -0
  636. package/stream-api/node_modules/router/package.json +44 -0
  637. package/stream-api/node_modules/safer-buffer/LICENSE +21 -0
  638. package/stream-api/node_modules/safer-buffer/Porting-Buffer.md +268 -0
  639. package/stream-api/node_modules/safer-buffer/Readme.md +156 -0
  640. package/stream-api/node_modules/safer-buffer/dangerous.js +58 -0
  641. package/stream-api/node_modules/safer-buffer/package.json +34 -0
  642. package/stream-api/node_modules/safer-buffer/safer.js +77 -0
  643. package/stream-api/node_modules/safer-buffer/tests.js +406 -0
  644. package/stream-api/node_modules/send/HISTORY.md +580 -0
  645. package/stream-api/node_modules/send/LICENSE +23 -0
  646. package/stream-api/node_modules/send/README.md +317 -0
  647. package/stream-api/node_modules/send/index.js +997 -0
  648. package/stream-api/node_modules/send/package.json +60 -0
  649. package/stream-api/node_modules/serve-static/HISTORY.md +516 -0
  650. package/stream-api/node_modules/serve-static/LICENSE +25 -0
  651. package/stream-api/node_modules/serve-static/README.md +253 -0
  652. package/stream-api/node_modules/serve-static/index.js +208 -0
  653. package/stream-api/node_modules/serve-static/package.json +41 -0
  654. package/stream-api/node_modules/setprototypeof/LICENSE +13 -0
  655. package/stream-api/node_modules/setprototypeof/README.md +31 -0
  656. package/stream-api/node_modules/setprototypeof/index.d.ts +2 -0
  657. package/stream-api/node_modules/setprototypeof/index.js +17 -0
  658. package/stream-api/node_modules/setprototypeof/package.json +38 -0
  659. package/stream-api/node_modules/setprototypeof/test/index.js +24 -0
  660. package/stream-api/node_modules/short-uuid/.codeclimate.yml +21 -0
  661. package/stream-api/node_modules/short-uuid/.csslintrc +2 -0
  662. package/stream-api/node_modules/short-uuid/.editorconfig +11 -0
  663. package/stream-api/node_modules/short-uuid/.eslintrc.js +15 -0
  664. package/stream-api/node_modules/short-uuid/.github/workflows/node.js.yml +31 -0
  665. package/stream-api/node_modules/short-uuid/.nyc_output/3a60ecc2-69fc-4d0a-81dd-ad79b6071e14.json +1 -0
  666. package/stream-api/node_modules/short-uuid/.nyc_output/3f261446-c11a-4630-b995-4f5dbc1395ef.json +1 -0
  667. package/stream-api/node_modules/short-uuid/.nyc_output/processinfo/3a60ecc2-69fc-4d0a-81dd-ad79b6071e14.json +1 -0
  668. package/stream-api/node_modules/short-uuid/.nyc_output/processinfo/3f261446-c11a-4630-b995-4f5dbc1395ef.json +1 -0
  669. package/stream-api/node_modules/short-uuid/.nyc_output/processinfo/index.json +1 -0
  670. package/stream-api/node_modules/short-uuid/CHANGELOG.md +237 -0
  671. package/stream-api/node_modules/short-uuid/LICENSE +21 -0
  672. package/stream-api/node_modules/short-uuid/README.md +128 -0
  673. package/stream-api/node_modules/short-uuid/index.d.ts +51 -0
  674. package/stream-api/node_modules/short-uuid/index.js +157 -0
  675. package/stream-api/node_modules/short-uuid/package.json +41 -0
  676. package/stream-api/node_modules/short-uuid/revisions.md +193 -0
  677. package/stream-api/node_modules/short-uuid/test/index.js +339 -0
  678. package/stream-api/node_modules/short-uuid/test/uuid25examples.js +74 -0
  679. package/stream-api/node_modules/side-channel/.editorconfig +9 -0
  680. package/stream-api/node_modules/side-channel/.eslintrc +12 -0
  681. package/stream-api/node_modules/side-channel/.github/FUNDING.yml +12 -0
  682. package/stream-api/node_modules/side-channel/.nycrc +13 -0
  683. package/stream-api/node_modules/side-channel/CHANGELOG.md +110 -0
  684. package/stream-api/node_modules/side-channel/LICENSE +21 -0
  685. package/stream-api/node_modules/side-channel/README.md +61 -0
  686. package/stream-api/node_modules/side-channel/index.d.ts +14 -0
  687. package/stream-api/node_modules/side-channel/index.js +43 -0
  688. package/stream-api/node_modules/side-channel/package.json +85 -0
  689. package/stream-api/node_modules/side-channel/test/index.js +104 -0
  690. package/stream-api/node_modules/side-channel/tsconfig.json +9 -0
  691. package/stream-api/node_modules/side-channel-list/.editorconfig +9 -0
  692. package/stream-api/node_modules/side-channel-list/.eslintrc +11 -0
  693. package/stream-api/node_modules/side-channel-list/.github/FUNDING.yml +12 -0
  694. package/stream-api/node_modules/side-channel-list/.nycrc +13 -0
  695. package/stream-api/node_modules/side-channel-list/CHANGELOG.md +15 -0
  696. package/stream-api/node_modules/side-channel-list/LICENSE +21 -0
  697. package/stream-api/node_modules/side-channel-list/README.md +62 -0
  698. package/stream-api/node_modules/side-channel-list/index.d.ts +13 -0
  699. package/stream-api/node_modules/side-channel-list/index.js +113 -0
  700. package/stream-api/node_modules/side-channel-list/list.d.ts +14 -0
  701. package/stream-api/node_modules/side-channel-list/package.json +77 -0
  702. package/stream-api/node_modules/side-channel-list/test/index.js +104 -0
  703. package/stream-api/node_modules/side-channel-list/tsconfig.json +9 -0
  704. package/stream-api/node_modules/side-channel-map/.editorconfig +9 -0
  705. package/stream-api/node_modules/side-channel-map/.eslintrc +11 -0
  706. package/stream-api/node_modules/side-channel-map/.github/FUNDING.yml +12 -0
  707. package/stream-api/node_modules/side-channel-map/.nycrc +13 -0
  708. package/stream-api/node_modules/side-channel-map/CHANGELOG.md +22 -0
  709. package/stream-api/node_modules/side-channel-map/LICENSE +21 -0
  710. package/stream-api/node_modules/side-channel-map/README.md +62 -0
  711. package/stream-api/node_modules/side-channel-map/index.d.ts +15 -0
  712. package/stream-api/node_modules/side-channel-map/index.js +68 -0
  713. package/stream-api/node_modules/side-channel-map/package.json +80 -0
  714. package/stream-api/node_modules/side-channel-map/test/index.js +114 -0
  715. package/stream-api/node_modules/side-channel-map/tsconfig.json +9 -0
  716. package/stream-api/node_modules/side-channel-weakmap/.editorconfig +9 -0
  717. package/stream-api/node_modules/side-channel-weakmap/.eslintrc +12 -0
  718. package/stream-api/node_modules/side-channel-weakmap/.github/FUNDING.yml +12 -0
  719. package/stream-api/node_modules/side-channel-weakmap/.nycrc +13 -0
  720. package/stream-api/node_modules/side-channel-weakmap/CHANGELOG.md +28 -0
  721. package/stream-api/node_modules/side-channel-weakmap/LICENSE +21 -0
  722. package/stream-api/node_modules/side-channel-weakmap/README.md +62 -0
  723. package/stream-api/node_modules/side-channel-weakmap/index.d.ts +15 -0
  724. package/stream-api/node_modules/side-channel-weakmap/index.js +84 -0
  725. package/stream-api/node_modules/side-channel-weakmap/package.json +87 -0
  726. package/stream-api/node_modules/side-channel-weakmap/test/index.js +114 -0
  727. package/stream-api/node_modules/side-channel-weakmap/tsconfig.json +9 -0
  728. package/stream-api/node_modules/statuses/HISTORY.md +87 -0
  729. package/stream-api/node_modules/statuses/LICENSE +23 -0
  730. package/stream-api/node_modules/statuses/README.md +139 -0
  731. package/stream-api/node_modules/statuses/codes.json +65 -0
  732. package/stream-api/node_modules/statuses/index.js +146 -0
  733. package/stream-api/node_modules/statuses/package.json +49 -0
  734. package/stream-api/node_modules/toidentifier/HISTORY.md +9 -0
  735. package/stream-api/node_modules/toidentifier/LICENSE +21 -0
  736. package/stream-api/node_modules/toidentifier/README.md +61 -0
  737. package/stream-api/node_modules/toidentifier/index.js +32 -0
  738. package/stream-api/node_modules/toidentifier/package.json +38 -0
  739. package/stream-api/node_modules/type-is/HISTORY.md +292 -0
  740. package/stream-api/node_modules/type-is/LICENSE +23 -0
  741. package/stream-api/node_modules/type-is/README.md +198 -0
  742. package/stream-api/node_modules/type-is/index.js +250 -0
  743. package/stream-api/node_modules/type-is/package.json +47 -0
  744. package/stream-api/node_modules/undici-types/LICENSE +21 -0
  745. package/stream-api/node_modules/undici-types/README.md +6 -0
  746. package/stream-api/node_modules/undici-types/agent.d.ts +32 -0
  747. package/stream-api/node_modules/undici-types/api.d.ts +43 -0
  748. package/stream-api/node_modules/undici-types/balanced-pool.d.ts +29 -0
  749. package/stream-api/node_modules/undici-types/cache-interceptor.d.ts +172 -0
  750. package/stream-api/node_modules/undici-types/cache.d.ts +36 -0
  751. package/stream-api/node_modules/undici-types/client-stats.d.ts +15 -0
  752. package/stream-api/node_modules/undici-types/client.d.ts +108 -0
  753. package/stream-api/node_modules/undici-types/connector.d.ts +34 -0
  754. package/stream-api/node_modules/undici-types/content-type.d.ts +21 -0
  755. package/stream-api/node_modules/undici-types/cookies.d.ts +30 -0
  756. package/stream-api/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
  757. package/stream-api/node_modules/undici-types/dispatcher.d.ts +276 -0
  758. package/stream-api/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  759. package/stream-api/node_modules/undici-types/errors.d.ts +161 -0
  760. package/stream-api/node_modules/undici-types/eventsource.d.ts +66 -0
  761. package/stream-api/node_modules/undici-types/fetch.d.ts +211 -0
  762. package/stream-api/node_modules/undici-types/formdata.d.ts +108 -0
  763. package/stream-api/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  764. package/stream-api/node_modules/undici-types/global-origin.d.ts +7 -0
  765. package/stream-api/node_modules/undici-types/h2c-client.d.ts +73 -0
  766. package/stream-api/node_modules/undici-types/handlers.d.ts +15 -0
  767. package/stream-api/node_modules/undici-types/header.d.ts +160 -0
  768. package/stream-api/node_modules/undici-types/index.d.ts +80 -0
  769. package/stream-api/node_modules/undici-types/interceptors.d.ts +39 -0
  770. package/stream-api/node_modules/undici-types/mock-agent.d.ts +68 -0
  771. package/stream-api/node_modules/undici-types/mock-call-history.d.ts +111 -0
  772. package/stream-api/node_modules/undici-types/mock-client.d.ts +27 -0
  773. package/stream-api/node_modules/undici-types/mock-errors.d.ts +12 -0
  774. package/stream-api/node_modules/undici-types/mock-interceptor.d.ts +94 -0
  775. package/stream-api/node_modules/undici-types/mock-pool.d.ts +27 -0
  776. package/stream-api/node_modules/undici-types/package.json +55 -0
  777. package/stream-api/node_modules/undici-types/patch.d.ts +29 -0
  778. package/stream-api/node_modules/undici-types/pool-stats.d.ts +19 -0
  779. package/stream-api/node_modules/undici-types/pool.d.ts +41 -0
  780. package/stream-api/node_modules/undici-types/proxy-agent.d.ts +29 -0
  781. package/stream-api/node_modules/undici-types/readable.d.ts +68 -0
  782. package/stream-api/node_modules/undici-types/retry-agent.d.ts +8 -0
  783. package/stream-api/node_modules/undici-types/retry-handler.d.ts +125 -0
  784. package/stream-api/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  785. package/stream-api/node_modules/undici-types/util.d.ts +18 -0
  786. package/stream-api/node_modules/undici-types/utility.d.ts +7 -0
  787. package/stream-api/node_modules/undici-types/webidl.d.ts +341 -0
  788. package/stream-api/node_modules/undici-types/websocket.d.ts +186 -0
  789. package/stream-api/node_modules/unpipe/HISTORY.md +4 -0
  790. package/stream-api/node_modules/unpipe/LICENSE +22 -0
  791. package/stream-api/node_modules/unpipe/README.md +43 -0
  792. package/stream-api/node_modules/unpipe/index.js +69 -0
  793. package/stream-api/node_modules/unpipe/package.json +27 -0
  794. package/stream-api/node_modules/uuid/CHANGELOG.md +274 -0
  795. package/stream-api/node_modules/uuid/CONTRIBUTING.md +18 -0
  796. package/stream-api/node_modules/uuid/LICENSE.md +9 -0
  797. package/stream-api/node_modules/uuid/README.md +466 -0
  798. package/stream-api/node_modules/uuid/dist/bin/uuid +2 -0
  799. package/stream-api/node_modules/uuid/dist/commonjs-browser/index.js +79 -0
  800. package/stream-api/node_modules/uuid/dist/commonjs-browser/md5.js +223 -0
  801. package/stream-api/node_modules/uuid/dist/commonjs-browser/native.js +11 -0
  802. package/stream-api/node_modules/uuid/dist/commonjs-browser/nil.js +8 -0
  803. package/stream-api/node_modules/uuid/dist/commonjs-browser/parse.js +45 -0
  804. package/stream-api/node_modules/uuid/dist/commonjs-browser/regex.js +8 -0
  805. package/stream-api/node_modules/uuid/dist/commonjs-browser/rng.js +25 -0
  806. package/stream-api/node_modules/uuid/dist/commonjs-browser/sha1.js +104 -0
  807. package/stream-api/node_modules/uuid/dist/commonjs-browser/stringify.js +44 -0
  808. package/stream-api/node_modules/uuid/dist/commonjs-browser/v1.js +107 -0
  809. package/stream-api/node_modules/uuid/dist/commonjs-browser/v3.js +16 -0
  810. package/stream-api/node_modules/uuid/dist/commonjs-browser/v35.js +80 -0
  811. package/stream-api/node_modules/uuid/dist/commonjs-browser/v4.js +43 -0
  812. package/stream-api/node_modules/uuid/dist/commonjs-browser/v5.js +16 -0
  813. package/stream-api/node_modules/uuid/dist/commonjs-browser/validate.js +17 -0
  814. package/stream-api/node_modules/uuid/dist/commonjs-browser/version.js +21 -0
  815. package/stream-api/node_modules/uuid/dist/esm-browser/index.js +9 -0
  816. package/stream-api/node_modules/uuid/dist/esm-browser/md5.js +215 -0
  817. package/stream-api/node_modules/uuid/dist/esm-browser/native.js +4 -0
  818. package/stream-api/node_modules/uuid/dist/esm-browser/nil.js +1 -0
  819. package/stream-api/node_modules/uuid/dist/esm-browser/parse.js +35 -0
  820. package/stream-api/node_modules/uuid/dist/esm-browser/regex.js +1 -0
  821. package/stream-api/node_modules/uuid/dist/esm-browser/rng.js +18 -0
  822. package/stream-api/node_modules/uuid/dist/esm-browser/sha1.js +96 -0
  823. package/stream-api/node_modules/uuid/dist/esm-browser/stringify.js +33 -0
  824. package/stream-api/node_modules/uuid/dist/esm-browser/v1.js +95 -0
  825. package/stream-api/node_modules/uuid/dist/esm-browser/v3.js +4 -0
  826. package/stream-api/node_modules/uuid/dist/esm-browser/v35.js +66 -0
  827. package/stream-api/node_modules/uuid/dist/esm-browser/v4.js +29 -0
  828. package/stream-api/node_modules/uuid/dist/esm-browser/v5.js +4 -0
  829. package/stream-api/node_modules/uuid/dist/esm-browser/validate.js +7 -0
  830. package/stream-api/node_modules/uuid/dist/esm-browser/version.js +11 -0
  831. package/stream-api/node_modules/uuid/dist/esm-node/index.js +9 -0
  832. package/stream-api/node_modules/uuid/dist/esm-node/md5.js +13 -0
  833. package/stream-api/node_modules/uuid/dist/esm-node/native.js +4 -0
  834. package/stream-api/node_modules/uuid/dist/esm-node/nil.js +1 -0
  835. package/stream-api/node_modules/uuid/dist/esm-node/parse.js +35 -0
  836. package/stream-api/node_modules/uuid/dist/esm-node/regex.js +1 -0
  837. package/stream-api/node_modules/uuid/dist/esm-node/rng.js +12 -0
  838. package/stream-api/node_modules/uuid/dist/esm-node/sha1.js +13 -0
  839. package/stream-api/node_modules/uuid/dist/esm-node/stringify.js +33 -0
  840. package/stream-api/node_modules/uuid/dist/esm-node/v1.js +95 -0
  841. package/stream-api/node_modules/uuid/dist/esm-node/v3.js +4 -0
  842. package/stream-api/node_modules/uuid/dist/esm-node/v35.js +66 -0
  843. package/stream-api/node_modules/uuid/dist/esm-node/v4.js +29 -0
  844. package/stream-api/node_modules/uuid/dist/esm-node/v5.js +4 -0
  845. package/stream-api/node_modules/uuid/dist/esm-node/validate.js +7 -0
  846. package/stream-api/node_modules/uuid/dist/esm-node/version.js +11 -0
  847. package/stream-api/node_modules/uuid/dist/index.js +79 -0
  848. package/stream-api/node_modules/uuid/dist/md5-browser.js +223 -0
  849. package/stream-api/node_modules/uuid/dist/md5.js +23 -0
  850. package/stream-api/node_modules/uuid/dist/native-browser.js +11 -0
  851. package/stream-api/node_modules/uuid/dist/native.js +15 -0
  852. package/stream-api/node_modules/uuid/dist/nil.js +8 -0
  853. package/stream-api/node_modules/uuid/dist/parse.js +45 -0
  854. package/stream-api/node_modules/uuid/dist/regex.js +8 -0
  855. package/stream-api/node_modules/uuid/dist/rng-browser.js +25 -0
  856. package/stream-api/node_modules/uuid/dist/rng.js +24 -0
  857. package/stream-api/node_modules/uuid/dist/sha1-browser.js +104 -0
  858. package/stream-api/node_modules/uuid/dist/sha1.js +23 -0
  859. package/stream-api/node_modules/uuid/dist/stringify.js +44 -0
  860. package/stream-api/node_modules/uuid/dist/uuid-bin.js +85 -0
  861. package/stream-api/node_modules/uuid/dist/v1.js +107 -0
  862. package/stream-api/node_modules/uuid/dist/v3.js +16 -0
  863. package/stream-api/node_modules/uuid/dist/v35.js +80 -0
  864. package/stream-api/node_modules/uuid/dist/v4.js +43 -0
  865. package/stream-api/node_modules/uuid/dist/v5.js +16 -0
  866. package/stream-api/node_modules/uuid/dist/validate.js +17 -0
  867. package/stream-api/node_modules/uuid/dist/version.js +21 -0
  868. package/stream-api/node_modules/uuid/package.json +135 -0
  869. package/stream-api/node_modules/uuid/wrapper.mjs +10 -0
  870. package/stream-api/node_modules/vary/HISTORY.md +39 -0
  871. package/stream-api/node_modules/vary/LICENSE +22 -0
  872. package/stream-api/node_modules/vary/README.md +101 -0
  873. package/stream-api/node_modules/vary/index.js +149 -0
  874. package/stream-api/node_modules/vary/package.json +43 -0
  875. package/stream-api/node_modules/wrappy/LICENSE +15 -0
  876. package/stream-api/node_modules/wrappy/README.md +36 -0
  877. package/stream-api/node_modules/wrappy/package.json +29 -0
  878. package/stream-api/node_modules/wrappy/wrappy.js +33 -0
  879. package/stream-api/package-lock.json +985 -0
  880. package/stream-api/package.json +25 -0
  881. package/stream-api/tsconfig.json +10 -0
@@ -0,0 +1,2134 @@
1
+ /**
2
+ * To use the HTTP server and client one must import the `node:http` module.
3
+ *
4
+ * The HTTP interfaces in Node.js are designed to support many features
5
+ * of the protocol which have been traditionally difficult to use.
6
+ * In particular, large, possibly chunk-encoded, messages. The interface is
7
+ * careful to never buffer entire requests or responses, so the
8
+ * user is able to stream data.
9
+ *
10
+ * HTTP message headers are represented by an object like this:
11
+ *
12
+ * ```json
13
+ * { "content-length": "123",
14
+ * "content-type": "text/plain",
15
+ * "connection": "keep-alive",
16
+ * "host": "example.com",
17
+ * "accept": "*" }
18
+ * ```
19
+ *
20
+ * Keys are lowercased. Values are not modified.
21
+ *
22
+ * In order to support the full spectrum of possible HTTP applications, the Node.js
23
+ * HTTP API is very low-level. It deals with stream handling and message
24
+ * parsing only. It parses a message into headers and body but it does not
25
+ * parse the actual headers or the body.
26
+ *
27
+ * See `message.headers` for details on how duplicate headers are handled.
28
+ *
29
+ * The raw headers as they were received are retained in the `rawHeaders` property, which is an array of `[key, value, key2, value2, ...]`. For
30
+ * example, the previous message header object might have a `rawHeaders` list like the following:
31
+ *
32
+ * ```js
33
+ * [ 'ConTent-Length', '123456',
34
+ * 'content-LENGTH', '123',
35
+ * 'content-type', 'text/plain',
36
+ * 'CONNECTION', 'keep-alive',
37
+ * 'Host', 'example.com',
38
+ * 'accepT', '*' ]
39
+ * ```
40
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/http.js)
41
+ */
42
+ declare module "http" {
43
+ import { NonSharedBuffer } from "node:buffer";
44
+ import * as stream from "node:stream";
45
+ import { URL } from "node:url";
46
+ import { LookupOptions } from "node:dns";
47
+ import { EventEmitter } from "node:events";
48
+ import { LookupFunction, Server as NetServer, Socket, TcpSocketConnectOpts } from "node:net";
49
+ // incoming headers will never contain number
50
+ interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> {
51
+ accept?: string | undefined;
52
+ "accept-encoding"?: string | undefined;
53
+ "accept-language"?: string | undefined;
54
+ "accept-patch"?: string | undefined;
55
+ "accept-ranges"?: string | undefined;
56
+ "access-control-allow-credentials"?: string | undefined;
57
+ "access-control-allow-headers"?: string | undefined;
58
+ "access-control-allow-methods"?: string | undefined;
59
+ "access-control-allow-origin"?: string | undefined;
60
+ "access-control-expose-headers"?: string | undefined;
61
+ "access-control-max-age"?: string | undefined;
62
+ "access-control-request-headers"?: string | undefined;
63
+ "access-control-request-method"?: string | undefined;
64
+ age?: string | undefined;
65
+ allow?: string | undefined;
66
+ "alt-svc"?: string | undefined;
67
+ authorization?: string | undefined;
68
+ "cache-control"?: string | undefined;
69
+ connection?: string | undefined;
70
+ "content-disposition"?: string | undefined;
71
+ "content-encoding"?: string | undefined;
72
+ "content-language"?: string | undefined;
73
+ "content-length"?: string | undefined;
74
+ "content-location"?: string | undefined;
75
+ "content-range"?: string | undefined;
76
+ "content-type"?: string | undefined;
77
+ cookie?: string | undefined;
78
+ date?: string | undefined;
79
+ etag?: string | undefined;
80
+ expect?: string | undefined;
81
+ expires?: string | undefined;
82
+ forwarded?: string | undefined;
83
+ from?: string | undefined;
84
+ host?: string | undefined;
85
+ "if-match"?: string | undefined;
86
+ "if-modified-since"?: string | undefined;
87
+ "if-none-match"?: string | undefined;
88
+ "if-unmodified-since"?: string | undefined;
89
+ "last-modified"?: string | undefined;
90
+ location?: string | undefined;
91
+ origin?: string | undefined;
92
+ pragma?: string | undefined;
93
+ "proxy-authenticate"?: string | undefined;
94
+ "proxy-authorization"?: string | undefined;
95
+ "public-key-pins"?: string | undefined;
96
+ range?: string | undefined;
97
+ referer?: string | undefined;
98
+ "retry-after"?: string | undefined;
99
+ "sec-fetch-site"?: string | undefined;
100
+ "sec-fetch-mode"?: string | undefined;
101
+ "sec-fetch-user"?: string | undefined;
102
+ "sec-fetch-dest"?: string | undefined;
103
+ "sec-websocket-accept"?: string | undefined;
104
+ "sec-websocket-extensions"?: string | undefined;
105
+ "sec-websocket-key"?: string | undefined;
106
+ "sec-websocket-protocol"?: string | undefined;
107
+ "sec-websocket-version"?: string | undefined;
108
+ "set-cookie"?: string[] | undefined;
109
+ "strict-transport-security"?: string | undefined;
110
+ tk?: string | undefined;
111
+ trailer?: string | undefined;
112
+ "transfer-encoding"?: string | undefined;
113
+ upgrade?: string | undefined;
114
+ "user-agent"?: string | undefined;
115
+ vary?: string | undefined;
116
+ via?: string | undefined;
117
+ warning?: string | undefined;
118
+ "www-authenticate"?: string | undefined;
119
+ }
120
+ // outgoing headers allows numbers (as they are converted internally to strings)
121
+ type OutgoingHttpHeader = number | string | string[];
122
+ interface OutgoingHttpHeaders extends NodeJS.Dict<OutgoingHttpHeader> {
123
+ accept?: string | string[] | undefined;
124
+ "accept-charset"?: string | string[] | undefined;
125
+ "accept-encoding"?: string | string[] | undefined;
126
+ "accept-language"?: string | string[] | undefined;
127
+ "accept-ranges"?: string | undefined;
128
+ "access-control-allow-credentials"?: string | undefined;
129
+ "access-control-allow-headers"?: string | undefined;
130
+ "access-control-allow-methods"?: string | undefined;
131
+ "access-control-allow-origin"?: string | undefined;
132
+ "access-control-expose-headers"?: string | undefined;
133
+ "access-control-max-age"?: string | undefined;
134
+ "access-control-request-headers"?: string | undefined;
135
+ "access-control-request-method"?: string | undefined;
136
+ age?: string | undefined;
137
+ allow?: string | undefined;
138
+ authorization?: string | undefined;
139
+ "cache-control"?: string | undefined;
140
+ "cdn-cache-control"?: string | undefined;
141
+ connection?: string | string[] | undefined;
142
+ "content-disposition"?: string | undefined;
143
+ "content-encoding"?: string | undefined;
144
+ "content-language"?: string | undefined;
145
+ "content-length"?: string | number | undefined;
146
+ "content-location"?: string | undefined;
147
+ "content-range"?: string | undefined;
148
+ "content-security-policy"?: string | undefined;
149
+ "content-security-policy-report-only"?: string | undefined;
150
+ "content-type"?: string | undefined;
151
+ cookie?: string | string[] | undefined;
152
+ dav?: string | string[] | undefined;
153
+ dnt?: string | undefined;
154
+ date?: string | undefined;
155
+ etag?: string | undefined;
156
+ expect?: string | undefined;
157
+ expires?: string | undefined;
158
+ forwarded?: string | undefined;
159
+ from?: string | undefined;
160
+ host?: string | undefined;
161
+ "if-match"?: string | undefined;
162
+ "if-modified-since"?: string | undefined;
163
+ "if-none-match"?: string | undefined;
164
+ "if-range"?: string | undefined;
165
+ "if-unmodified-since"?: string | undefined;
166
+ "last-modified"?: string | undefined;
167
+ link?: string | string[] | undefined;
168
+ location?: string | undefined;
169
+ "max-forwards"?: string | undefined;
170
+ origin?: string | undefined;
171
+ pragma?: string | string[] | undefined;
172
+ "proxy-authenticate"?: string | string[] | undefined;
173
+ "proxy-authorization"?: string | undefined;
174
+ "public-key-pins"?: string | undefined;
175
+ "public-key-pins-report-only"?: string | undefined;
176
+ range?: string | undefined;
177
+ referer?: string | undefined;
178
+ "referrer-policy"?: string | undefined;
179
+ refresh?: string | undefined;
180
+ "retry-after"?: string | undefined;
181
+ "sec-websocket-accept"?: string | undefined;
182
+ "sec-websocket-extensions"?: string | string[] | undefined;
183
+ "sec-websocket-key"?: string | undefined;
184
+ "sec-websocket-protocol"?: string | string[] | undefined;
185
+ "sec-websocket-version"?: string | undefined;
186
+ server?: string | undefined;
187
+ "set-cookie"?: string | string[] | undefined;
188
+ "strict-transport-security"?: string | undefined;
189
+ te?: string | undefined;
190
+ trailer?: string | undefined;
191
+ "transfer-encoding"?: string | undefined;
192
+ "user-agent"?: string | undefined;
193
+ upgrade?: string | undefined;
194
+ "upgrade-insecure-requests"?: string | undefined;
195
+ vary?: string | undefined;
196
+ via?: string | string[] | undefined;
197
+ warning?: string | undefined;
198
+ "www-authenticate"?: string | string[] | undefined;
199
+ "x-content-type-options"?: string | undefined;
200
+ "x-dns-prefetch-control"?: string | undefined;
201
+ "x-frame-options"?: string | undefined;
202
+ "x-xss-protection"?: string | undefined;
203
+ }
204
+ interface ClientRequestArgs extends Pick<LookupOptions, "hints"> {
205
+ _defaultAgent?: Agent | undefined;
206
+ agent?: Agent | boolean | undefined;
207
+ auth?: string | null | undefined;
208
+ createConnection?:
209
+ | ((
210
+ options: ClientRequestArgs,
211
+ oncreate: (err: Error | null, socket: stream.Duplex) => void,
212
+ ) => stream.Duplex | null | undefined)
213
+ | undefined;
214
+ defaultPort?: number | string | undefined;
215
+ family?: number | undefined;
216
+ headers?: OutgoingHttpHeaders | readonly string[] | undefined;
217
+ host?: string | null | undefined;
218
+ hostname?: string | null | undefined;
219
+ insecureHTTPParser?: boolean | undefined;
220
+ localAddress?: string | undefined;
221
+ localPort?: number | undefined;
222
+ lookup?: LookupFunction | undefined;
223
+ /**
224
+ * @default 16384
225
+ */
226
+ maxHeaderSize?: number | undefined;
227
+ method?: string | undefined;
228
+ path?: string | null | undefined;
229
+ port?: number | string | null | undefined;
230
+ protocol?: string | null | undefined;
231
+ setDefaultHeaders?: boolean | undefined;
232
+ setHost?: boolean | undefined;
233
+ signal?: AbortSignal | undefined;
234
+ socketPath?: string | undefined;
235
+ timeout?: number | undefined;
236
+ uniqueHeaders?: Array<string | string[]> | undefined;
237
+ joinDuplicateHeaders?: boolean | undefined;
238
+ }
239
+ interface ServerOptions<
240
+ Request extends typeof IncomingMessage = typeof IncomingMessage,
241
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
242
+ > {
243
+ /**
244
+ * Specifies the `IncomingMessage` class to be used. Useful for extending the original `IncomingMessage`.
245
+ */
246
+ IncomingMessage?: Request | undefined;
247
+ /**
248
+ * Specifies the `ServerResponse` class to be used. Useful for extending the original `ServerResponse`.
249
+ */
250
+ ServerResponse?: Response | undefined;
251
+ /**
252
+ * Sets the timeout value in milliseconds for receiving the entire request from the client.
253
+ * @see Server.requestTimeout for more information.
254
+ * @default 300000
255
+ * @since v18.0.0
256
+ */
257
+ requestTimeout?: number | undefined;
258
+ /**
259
+ * It joins the field line values of multiple headers in a request with `, ` instead of discarding the duplicates.
260
+ * @default false
261
+ * @since v18.14.0
262
+ */
263
+ joinDuplicateHeaders?: boolean | undefined;
264
+ /**
265
+ * The number of milliseconds of inactivity a server needs to wait for additional incoming data,
266
+ * after it has finished writing the last response, before a socket will be destroyed.
267
+ * @see Server.keepAliveTimeout for more information.
268
+ * @default 5000
269
+ * @since v18.0.0
270
+ */
271
+ keepAliveTimeout?: number | undefined;
272
+ /**
273
+ * An additional buffer time added to the
274
+ * `server.keepAliveTimeout` to extend the internal socket timeout.
275
+ * @since 24.6.0
276
+ * @default 1000
277
+ */
278
+ keepAliveTimeoutBuffer?: number | undefined;
279
+ /**
280
+ * Sets the interval value in milliseconds to check for request and headers timeout in incomplete requests.
281
+ * @default 30000
282
+ */
283
+ connectionsCheckingInterval?: number | undefined;
284
+ /**
285
+ * Sets the timeout value in milliseconds for receiving the complete HTTP headers from the client.
286
+ * See {@link Server.headersTimeout} for more information.
287
+ * @default 60000
288
+ * @since 18.0.0
289
+ */
290
+ headersTimeout?: number | undefined;
291
+ /**
292
+ * Optionally overrides all `socket`s' `readableHighWaterMark` and `writableHighWaterMark`.
293
+ * This affects `highWaterMark` property of both `IncomingMessage` and `ServerResponse`.
294
+ * Default: @see stream.getDefaultHighWaterMark().
295
+ * @since v20.1.0
296
+ */
297
+ highWaterMark?: number | undefined;
298
+ /**
299
+ * Use an insecure HTTP parser that accepts invalid HTTP headers when `true`.
300
+ * Using the insecure parser should be avoided.
301
+ * See --insecure-http-parser for more information.
302
+ * @default false
303
+ */
304
+ insecureHTTPParser?: boolean | undefined;
305
+ /**
306
+ * Optionally overrides the value of `--max-http-header-size` for requests received by
307
+ * this server, i.e. the maximum length of request headers in bytes.
308
+ * @default 16384
309
+ * @since v13.3.0
310
+ */
311
+ maxHeaderSize?: number | undefined;
312
+ /**
313
+ * If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received.
314
+ * @default true
315
+ * @since v16.5.0
316
+ */
317
+ noDelay?: boolean | undefined;
318
+ /**
319
+ * If set to `true`, it forces the server to respond with a 400 (Bad Request) status code
320
+ * to any HTTP/1.1 request message that lacks a Host header (as mandated by the specification).
321
+ * @default true
322
+ * @since 20.0.0
323
+ */
324
+ requireHostHeader?: boolean | undefined;
325
+ /**
326
+ * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received,
327
+ * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`.
328
+ * @default false
329
+ * @since v16.5.0
330
+ */
331
+ keepAlive?: boolean | undefined;
332
+ /**
333
+ * If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket.
334
+ * @default 0
335
+ * @since v16.5.0
336
+ */
337
+ keepAliveInitialDelay?: number | undefined;
338
+ /**
339
+ * A list of response headers that should be sent only once.
340
+ * If the header's value is an array, the items will be joined using `; `.
341
+ */
342
+ uniqueHeaders?: Array<string | string[]> | undefined;
343
+ /**
344
+ * A callback which receives an
345
+ * incoming request and returns a boolean, to control which upgrade attempts
346
+ * should be accepted. Accepted upgrades will fire an `'upgrade'` event (or
347
+ * their sockets will be destroyed, if no listener is registered) while
348
+ * rejected upgrades will fire a `'request'` event like any non-upgrade
349
+ * request.
350
+ * @since v24.9.0
351
+ * @default () => server.listenerCount('upgrade') > 0
352
+ */
353
+ shouldUpgradeCallback?: ((request: InstanceType<Request>) => boolean) | undefined;
354
+ /**
355
+ * If set to `true`, an error is thrown when writing to an HTTP response which does not have a body.
356
+ * @default false
357
+ * @since v18.17.0, v20.2.0
358
+ */
359
+ rejectNonStandardBodyWrites?: boolean | undefined;
360
+ }
361
+ type RequestListener<
362
+ Request extends typeof IncomingMessage = typeof IncomingMessage,
363
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
364
+ > = (req: InstanceType<Request>, res: InstanceType<Response> & { req: InstanceType<Request> }) => void;
365
+ /**
366
+ * @since v0.1.17
367
+ */
368
+ class Server<
369
+ Request extends typeof IncomingMessage = typeof IncomingMessage,
370
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
371
+ > extends NetServer {
372
+ constructor(requestListener?: RequestListener<Request, Response>);
373
+ constructor(options: ServerOptions<Request, Response>, requestListener?: RequestListener<Request, Response>);
374
+ /**
375
+ * Sets the timeout value for sockets, and emits a `'timeout'` event on
376
+ * the Server object, passing the socket as an argument, if a timeout
377
+ * occurs.
378
+ *
379
+ * If there is a `'timeout'` event listener on the Server object, then it
380
+ * will be called with the timed-out socket as an argument.
381
+ *
382
+ * By default, the Server does not timeout sockets. However, if a callback
383
+ * is assigned to the Server's `'timeout'` event, timeouts must be handled
384
+ * explicitly.
385
+ * @since v0.9.12
386
+ * @param [msecs=0 (no timeout)]
387
+ */
388
+ setTimeout(msecs?: number, callback?: (socket: Socket) => void): this;
389
+ setTimeout(callback: (socket: Socket) => void): this;
390
+ /**
391
+ * Limits maximum incoming headers count. If set to 0, no limit will be applied.
392
+ * @since v0.7.0
393
+ */
394
+ maxHeadersCount: number | null;
395
+ /**
396
+ * The maximum number of requests socket can handle
397
+ * before closing keep alive connection.
398
+ *
399
+ * A value of `0` will disable the limit.
400
+ *
401
+ * When the limit is reached it will set the `Connection` header value to `close`,
402
+ * but will not actually close the connection, subsequent requests sent
403
+ * after the limit is reached will get `503 Service Unavailable` as a response.
404
+ * @since v16.10.0
405
+ */
406
+ maxRequestsPerSocket: number | null;
407
+ /**
408
+ * The number of milliseconds of inactivity before a socket is presumed
409
+ * to have timed out.
410
+ *
411
+ * A value of `0` will disable the timeout behavior on incoming connections.
412
+ *
413
+ * The socket timeout logic is set up on connection, so changing this
414
+ * value only affects new connections to the server, not any existing connections.
415
+ * @since v0.9.12
416
+ */
417
+ timeout: number;
418
+ /**
419
+ * Limit the amount of time the parser will wait to receive the complete HTTP
420
+ * headers.
421
+ *
422
+ * If the timeout expires, the server responds with status 408 without
423
+ * forwarding the request to the request listener and then closes the connection.
424
+ *
425
+ * It must be set to a non-zero value (e.g. 120 seconds) to protect against
426
+ * potential Denial-of-Service attacks in case the server is deployed without a
427
+ * reverse proxy in front.
428
+ * @since v11.3.0, v10.14.0
429
+ */
430
+ headersTimeout: number;
431
+ /**
432
+ * The number of milliseconds of inactivity a server needs to wait for additional
433
+ * incoming data, after it has finished writing the last response, before a socket
434
+ * will be destroyed.
435
+ *
436
+ * This timeout value is combined with the
437
+ * `server.keepAliveTimeoutBuffer` option to determine the actual socket
438
+ * timeout, calculated as:
439
+ * socketTimeout = keepAliveTimeout + keepAliveTimeoutBuffer
440
+ * If the server receives new data before the keep-alive timeout has fired, it
441
+ * will reset the regular inactivity timeout, i.e., `server.timeout`.
442
+ *
443
+ * A value of `0` will disable the keep-alive timeout behavior on incoming
444
+ * connections.
445
+ * A value of `0` makes the HTTP server behave similarly to Node.js versions prior
446
+ * to 8.0.0, which did not have a keep-alive timeout.
447
+ *
448
+ * The socket timeout logic is set up on connection, so changing this value only
449
+ * affects new connections to the server, not any existing connections.
450
+ * @since v8.0.0
451
+ */
452
+ keepAliveTimeout: number;
453
+ /**
454
+ * An additional buffer time added to the
455
+ * `server.keepAliveTimeout` to extend the internal socket timeout.
456
+ *
457
+ * This buffer helps reduce connection reset (`ECONNRESET`) errors by increasing
458
+ * the socket timeout slightly beyond the advertised keep-alive timeout.
459
+ *
460
+ * This option applies only to new incoming connections.
461
+ * @since v24.6.0
462
+ * @default 1000
463
+ */
464
+ keepAliveTimeoutBuffer: number;
465
+ /**
466
+ * Sets the timeout value in milliseconds for receiving the entire request from
467
+ * the client.
468
+ *
469
+ * If the timeout expires, the server responds with status 408 without
470
+ * forwarding the request to the request listener and then closes the connection.
471
+ *
472
+ * It must be set to a non-zero value (e.g. 120 seconds) to protect against
473
+ * potential Denial-of-Service attacks in case the server is deployed without a
474
+ * reverse proxy in front.
475
+ * @since v14.11.0
476
+ */
477
+ requestTimeout: number;
478
+ /**
479
+ * Closes all connections connected to this server.
480
+ * @since v18.2.0
481
+ */
482
+ closeAllConnections(): void;
483
+ /**
484
+ * Closes all connections connected to this server which are not sending a request
485
+ * or waiting for a response.
486
+ * @since v18.2.0
487
+ */
488
+ closeIdleConnections(): void;
489
+ addListener(event: string, listener: (...args: any[]) => void): this;
490
+ addListener(event: "close", listener: () => void): this;
491
+ addListener(event: "connection", listener: (socket: Socket) => void): this;
492
+ addListener(event: "error", listener: (err: Error) => void): this;
493
+ addListener(event: "listening", listener: () => void): this;
494
+ addListener(event: "checkContinue", listener: RequestListener<Request, Response>): this;
495
+ addListener(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
496
+ addListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
497
+ addListener(
498
+ event: "connect",
499
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
500
+ ): this;
501
+ addListener(event: "dropRequest", listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
502
+ addListener(event: "request", listener: RequestListener<Request, Response>): this;
503
+ addListener(
504
+ event: "upgrade",
505
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
506
+ ): this;
507
+ emit(event: string, ...args: any[]): boolean;
508
+ emit(event: "close"): boolean;
509
+ emit(event: "connection", socket: Socket): boolean;
510
+ emit(event: "error", err: Error): boolean;
511
+ emit(event: "listening"): boolean;
512
+ emit(
513
+ event: "checkContinue",
514
+ req: InstanceType<Request>,
515
+ res: InstanceType<Response> & { req: InstanceType<Request> },
516
+ ): boolean;
517
+ emit(
518
+ event: "checkExpectation",
519
+ req: InstanceType<Request>,
520
+ res: InstanceType<Response> & { req: InstanceType<Request> },
521
+ ): boolean;
522
+ emit(event: "clientError", err: Error, socket: stream.Duplex): boolean;
523
+ emit(event: "connect", req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer): boolean;
524
+ emit(event: "dropRequest", req: InstanceType<Request>, socket: stream.Duplex): boolean;
525
+ emit(
526
+ event: "request",
527
+ req: InstanceType<Request>,
528
+ res: InstanceType<Response> & { req: InstanceType<Request> },
529
+ ): boolean;
530
+ emit(event: "upgrade", req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer): boolean;
531
+ on(event: string, listener: (...args: any[]) => void): this;
532
+ on(event: "close", listener: () => void): this;
533
+ on(event: "connection", listener: (socket: Socket) => void): this;
534
+ on(event: "error", listener: (err: Error) => void): this;
535
+ on(event: "listening", listener: () => void): this;
536
+ on(event: "checkContinue", listener: RequestListener<Request, Response>): this;
537
+ on(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
538
+ on(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
539
+ on(
540
+ event: "connect",
541
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
542
+ ): this;
543
+ on(event: "dropRequest", listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
544
+ on(event: "request", listener: RequestListener<Request, Response>): this;
545
+ on(
546
+ event: "upgrade",
547
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
548
+ ): this;
549
+ once(event: string, listener: (...args: any[]) => void): this;
550
+ once(event: "close", listener: () => void): this;
551
+ once(event: "connection", listener: (socket: Socket) => void): this;
552
+ once(event: "error", listener: (err: Error) => void): this;
553
+ once(event: "listening", listener: () => void): this;
554
+ once(event: "checkContinue", listener: RequestListener<Request, Response>): this;
555
+ once(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
556
+ once(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
557
+ once(
558
+ event: "connect",
559
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
560
+ ): this;
561
+ once(event: "dropRequest", listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
562
+ once(event: "request", listener: RequestListener<Request, Response>): this;
563
+ once(
564
+ event: "upgrade",
565
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
566
+ ): this;
567
+ prependListener(event: string, listener: (...args: any[]) => void): this;
568
+ prependListener(event: "close", listener: () => void): this;
569
+ prependListener(event: "connection", listener: (socket: Socket) => void): this;
570
+ prependListener(event: "error", listener: (err: Error) => void): this;
571
+ prependListener(event: "listening", listener: () => void): this;
572
+ prependListener(event: "checkContinue", listener: RequestListener<Request, Response>): this;
573
+ prependListener(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
574
+ prependListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
575
+ prependListener(
576
+ event: "connect",
577
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
578
+ ): this;
579
+ prependListener(
580
+ event: "dropRequest",
581
+ listener: (req: InstanceType<Request>, socket: stream.Duplex) => void,
582
+ ): this;
583
+ prependListener(event: "request", listener: RequestListener<Request, Response>): this;
584
+ prependListener(
585
+ event: "upgrade",
586
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
587
+ ): this;
588
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
589
+ prependOnceListener(event: "close", listener: () => void): this;
590
+ prependOnceListener(event: "connection", listener: (socket: Socket) => void): this;
591
+ prependOnceListener(event: "error", listener: (err: Error) => void): this;
592
+ prependOnceListener(event: "listening", listener: () => void): this;
593
+ prependOnceListener(event: "checkContinue", listener: RequestListener<Request, Response>): this;
594
+ prependOnceListener(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
595
+ prependOnceListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
596
+ prependOnceListener(
597
+ event: "connect",
598
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
599
+ ): this;
600
+ prependOnceListener(
601
+ event: "dropRequest",
602
+ listener: (req: InstanceType<Request>, socket: stream.Duplex) => void,
603
+ ): this;
604
+ prependOnceListener(event: "request", listener: RequestListener<Request, Response>): this;
605
+ prependOnceListener(
606
+ event: "upgrade",
607
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
608
+ ): this;
609
+ }
610
+ /**
611
+ * This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract outgoing message from
612
+ * the perspective of the participants of an HTTP transaction.
613
+ * @since v0.1.17
614
+ */
615
+ class OutgoingMessage<Request extends IncomingMessage = IncomingMessage> extends stream.Writable {
616
+ readonly req: Request;
617
+ chunkedEncoding: boolean;
618
+ shouldKeepAlive: boolean;
619
+ useChunkedEncodingByDefault: boolean;
620
+ sendDate: boolean;
621
+ /**
622
+ * @deprecated Use `writableEnded` instead.
623
+ */
624
+ finished: boolean;
625
+ /**
626
+ * Read-only. `true` if the headers were sent, otherwise `false`.
627
+ * @since v0.9.3
628
+ */
629
+ readonly headersSent: boolean;
630
+ /**
631
+ * Alias of `outgoingMessage.socket`.
632
+ * @since v0.3.0
633
+ * @deprecated Since v15.12.0,v14.17.1 - Use `socket` instead.
634
+ */
635
+ readonly connection: Socket | null;
636
+ /**
637
+ * Reference to the underlying socket. Usually, users will not want to access
638
+ * this property.
639
+ *
640
+ * After calling `outgoingMessage.end()`, this property will be nulled.
641
+ * @since v0.3.0
642
+ */
643
+ readonly socket: Socket | null;
644
+ constructor();
645
+ /**
646
+ * Once a socket is associated with the message and is connected, `socket.setTimeout()` will be called with `msecs` as the first parameter.
647
+ * @since v0.9.12
648
+ * @param callback Optional function to be called when a timeout occurs. Same as binding to the `timeout` event.
649
+ */
650
+ setTimeout(msecs: number, callback?: () => void): this;
651
+ /**
652
+ * Sets a single header value. If the header already exists in the to-be-sent
653
+ * headers, its value will be replaced. Use an array of strings to send multiple
654
+ * headers with the same name.
655
+ * @since v0.4.0
656
+ * @param name Header name
657
+ * @param value Header value
658
+ */
659
+ setHeader(name: string, value: number | string | readonly string[]): this;
660
+ /**
661
+ * Sets multiple header values for implicit headers. headers must be an instance of
662
+ * `Headers` or `Map`, if a header already exists in the to-be-sent headers, its
663
+ * value will be replaced.
664
+ *
665
+ * ```js
666
+ * const headers = new Headers({ foo: 'bar' });
667
+ * outgoingMessage.setHeaders(headers);
668
+ * ```
669
+ *
670
+ * or
671
+ *
672
+ * ```js
673
+ * const headers = new Map([['foo', 'bar']]);
674
+ * outgoingMessage.setHeaders(headers);
675
+ * ```
676
+ *
677
+ * When headers have been set with `outgoingMessage.setHeaders()`, they will be
678
+ * merged with any headers passed to `response.writeHead()`, with the headers passed
679
+ * to `response.writeHead()` given precedence.
680
+ *
681
+ * ```js
682
+ * // Returns content-type = text/plain
683
+ * const server = http.createServer((req, res) => {
684
+ * const headers = new Headers({ 'Content-Type': 'text/html' });
685
+ * res.setHeaders(headers);
686
+ * res.writeHead(200, { 'Content-Type': 'text/plain' });
687
+ * res.end('ok');
688
+ * });
689
+ * ```
690
+ *
691
+ * @since v19.6.0, v18.15.0
692
+ * @param name Header name
693
+ * @param value Header value
694
+ */
695
+ setHeaders(headers: Headers | Map<string, number | string | readonly string[]>): this;
696
+ /**
697
+ * Append a single header value to the header object.
698
+ *
699
+ * If the value is an array, this is equivalent to calling this method multiple
700
+ * times.
701
+ *
702
+ * If there were no previous values for the header, this is equivalent to calling `outgoingMessage.setHeader(name, value)`.
703
+ *
704
+ * Depending of the value of `options.uniqueHeaders` when the client request or the
705
+ * server were created, this will end up in the header being sent multiple times or
706
+ * a single time with values joined using `; `.
707
+ * @since v18.3.0, v16.17.0
708
+ * @param name Header name
709
+ * @param value Header value
710
+ */
711
+ appendHeader(name: string, value: string | readonly string[]): this;
712
+ /**
713
+ * Gets the value of the HTTP header with the given name. If that header is not
714
+ * set, the returned value will be `undefined`.
715
+ * @since v0.4.0
716
+ * @param name Name of header
717
+ */
718
+ getHeader(name: string): number | string | string[] | undefined;
719
+ /**
720
+ * Returns a shallow copy of the current outgoing headers. Since a shallow
721
+ * copy is used, array values may be mutated without additional calls to
722
+ * various header-related HTTP module methods. The keys of the returned
723
+ * object are the header names and the values are the respective header
724
+ * values. All header names are lowercase.
725
+ *
726
+ * The object returned by the `outgoingMessage.getHeaders()` method does
727
+ * not prototypically inherit from the JavaScript `Object`. This means that
728
+ * typical `Object` methods such as `obj.toString()`, `obj.hasOwnProperty()`,
729
+ * and others are not defined and will not work.
730
+ *
731
+ * ```js
732
+ * outgoingMessage.setHeader('Foo', 'bar');
733
+ * outgoingMessage.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);
734
+ *
735
+ * const headers = outgoingMessage.getHeaders();
736
+ * // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] }
737
+ * ```
738
+ * @since v7.7.0
739
+ */
740
+ getHeaders(): OutgoingHttpHeaders;
741
+ /**
742
+ * Returns an array containing the unique names of the current outgoing headers.
743
+ * All names are lowercase.
744
+ * @since v7.7.0
745
+ */
746
+ getHeaderNames(): string[];
747
+ /**
748
+ * Returns `true` if the header identified by `name` is currently set in the
749
+ * outgoing headers. The header name is case-insensitive.
750
+ *
751
+ * ```js
752
+ * const hasContentType = outgoingMessage.hasHeader('content-type');
753
+ * ```
754
+ * @since v7.7.0
755
+ */
756
+ hasHeader(name: string): boolean;
757
+ /**
758
+ * Removes a header that is queued for implicit sending.
759
+ *
760
+ * ```js
761
+ * outgoingMessage.removeHeader('Content-Encoding');
762
+ * ```
763
+ * @since v0.4.0
764
+ * @param name Header name
765
+ */
766
+ removeHeader(name: string): void;
767
+ /**
768
+ * Adds HTTP trailers (headers but at the end of the message) to the message.
769
+ *
770
+ * Trailers will **only** be emitted if the message is chunked encoded. If not,
771
+ * the trailers will be silently discarded.
772
+ *
773
+ * HTTP requires the `Trailer` header to be sent to emit trailers,
774
+ * with a list of header field names in its value, e.g.
775
+ *
776
+ * ```js
777
+ * message.writeHead(200, { 'Content-Type': 'text/plain',
778
+ * 'Trailer': 'Content-MD5' });
779
+ * message.write(fileData);
780
+ * message.addTrailers({ 'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667' });
781
+ * message.end();
782
+ * ```
783
+ *
784
+ * Attempting to set a header field name or value that contains invalid characters
785
+ * will result in a `TypeError` being thrown.
786
+ * @since v0.3.0
787
+ */
788
+ addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void;
789
+ /**
790
+ * Flushes the message headers.
791
+ *
792
+ * For efficiency reason, Node.js normally buffers the message headers
793
+ * until `outgoingMessage.end()` is called or the first chunk of message data
794
+ * is written. It then tries to pack the headers and data into a single TCP
795
+ * packet.
796
+ *
797
+ * It is usually desired (it saves a TCP round-trip), but not when the first
798
+ * data is not sent until possibly much later. `outgoingMessage.flushHeaders()` bypasses the optimization and kickstarts the message.
799
+ * @since v1.6.0
800
+ */
801
+ flushHeaders(): void;
802
+ }
803
+ /**
804
+ * This object is created internally by an HTTP server, not by the user. It is
805
+ * passed as the second parameter to the `'request'` event.
806
+ * @since v0.1.17
807
+ */
808
+ class ServerResponse<Request extends IncomingMessage = IncomingMessage> extends OutgoingMessage<Request> {
809
+ /**
810
+ * When using implicit headers (not calling `response.writeHead()` explicitly),
811
+ * this property controls the status code that will be sent to the client when
812
+ * the headers get flushed.
813
+ *
814
+ * ```js
815
+ * response.statusCode = 404;
816
+ * ```
817
+ *
818
+ * After response header was sent to the client, this property indicates the
819
+ * status code which was sent out.
820
+ * @since v0.4.0
821
+ */
822
+ statusCode: number;
823
+ /**
824
+ * When using implicit headers (not calling `response.writeHead()` explicitly),
825
+ * this property controls the status message that will be sent to the client when
826
+ * the headers get flushed. If this is left as `undefined` then the standard
827
+ * message for the status code will be used.
828
+ *
829
+ * ```js
830
+ * response.statusMessage = 'Not found';
831
+ * ```
832
+ *
833
+ * After response header was sent to the client, this property indicates the
834
+ * status message which was sent out.
835
+ * @since v0.11.8
836
+ */
837
+ statusMessage: string;
838
+ /**
839
+ * If set to `true`, Node.js will check whether the `Content-Length` header value and the size of the body, in bytes, are equal.
840
+ * Mismatching the `Content-Length` header value will result
841
+ * in an `Error` being thrown, identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`.
842
+ * @since v18.10.0, v16.18.0
843
+ */
844
+ strictContentLength: boolean;
845
+ constructor(req: Request);
846
+ assignSocket(socket: Socket): void;
847
+ detachSocket(socket: Socket): void;
848
+ /**
849
+ * Sends an HTTP/1.1 100 Continue message to the client, indicating that
850
+ * the request body should be sent. See the `'checkContinue'` event on `Server`.
851
+ * @since v0.3.0
852
+ */
853
+ writeContinue(callback?: () => void): void;
854
+ /**
855
+ * Sends an HTTP/1.1 103 Early Hints message to the client with a Link header,
856
+ * indicating that the user agent can preload/preconnect the linked resources.
857
+ * The `hints` is an object containing the values of headers to be sent with
858
+ * early hints message. The optional `callback` argument will be called when
859
+ * the response message has been written.
860
+ *
861
+ * **Example**
862
+ *
863
+ * ```js
864
+ * const earlyHintsLink = '</styles.css>; rel=preload; as=style';
865
+ * response.writeEarlyHints({
866
+ * 'link': earlyHintsLink,
867
+ * });
868
+ *
869
+ * const earlyHintsLinks = [
870
+ * '</styles.css>; rel=preload; as=style',
871
+ * '</scripts.js>; rel=preload; as=script',
872
+ * ];
873
+ * response.writeEarlyHints({
874
+ * 'link': earlyHintsLinks,
875
+ * 'x-trace-id': 'id for diagnostics',
876
+ * });
877
+ *
878
+ * const earlyHintsCallback = () => console.log('early hints message sent');
879
+ * response.writeEarlyHints({
880
+ * 'link': earlyHintsLinks,
881
+ * }, earlyHintsCallback);
882
+ * ```
883
+ * @since v18.11.0
884
+ * @param hints An object containing the values of headers
885
+ * @param callback Will be called when the response message has been written
886
+ */
887
+ writeEarlyHints(hints: Record<string, string | string[]>, callback?: () => void): void;
888
+ /**
889
+ * Sends a response header to the request. The status code is a 3-digit HTTP
890
+ * status code, like `404`. The last argument, `headers`, are the response headers.
891
+ * Optionally one can give a human-readable `statusMessage` as the second
892
+ * argument.
893
+ *
894
+ * `headers` may be an `Array` where the keys and values are in the same list.
895
+ * It is _not_ a list of tuples. So, the even-numbered offsets are key values,
896
+ * and the odd-numbered offsets are the associated values. The array is in the same
897
+ * format as `request.rawHeaders`.
898
+ *
899
+ * Returns a reference to the `ServerResponse`, so that calls can be chained.
900
+ *
901
+ * ```js
902
+ * const body = 'hello world';
903
+ * response
904
+ * .writeHead(200, {
905
+ * 'Content-Length': Buffer.byteLength(body),
906
+ * 'Content-Type': 'text/plain',
907
+ * })
908
+ * .end(body);
909
+ * ```
910
+ *
911
+ * This method must only be called once on a message and it must
912
+ * be called before `response.end()` is called.
913
+ *
914
+ * If `response.write()` or `response.end()` are called before calling
915
+ * this, the implicit/mutable headers will be calculated and call this function.
916
+ *
917
+ * When headers have been set with `response.setHeader()`, they will be merged
918
+ * with any headers passed to `response.writeHead()`, with the headers passed
919
+ * to `response.writeHead()` given precedence.
920
+ *
921
+ * If this method is called and `response.setHeader()` has not been called,
922
+ * it will directly write the supplied header values onto the network channel
923
+ * without caching internally, and the `response.getHeader()` on the header
924
+ * will not yield the expected result. If progressive population of headers is
925
+ * desired with potential future retrieval and modification, use `response.setHeader()` instead.
926
+ *
927
+ * ```js
928
+ * // Returns content-type = text/plain
929
+ * const server = http.createServer((req, res) => {
930
+ * res.setHeader('Content-Type', 'text/html');
931
+ * res.setHeader('X-Foo', 'bar');
932
+ * res.writeHead(200, { 'Content-Type': 'text/plain' });
933
+ * res.end('ok');
934
+ * });
935
+ * ```
936
+ *
937
+ * `Content-Length` is read in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. Node.js
938
+ * will check whether `Content-Length` and the length of the body which has
939
+ * been transmitted are equal or not.
940
+ *
941
+ * Attempting to set a header field name or value that contains invalid characters
942
+ * will result in a \[`Error`\]\[\] being thrown.
943
+ * @since v0.1.30
944
+ */
945
+ writeHead(
946
+ statusCode: number,
947
+ statusMessage?: string,
948
+ headers?: OutgoingHttpHeaders | OutgoingHttpHeader[],
949
+ ): this;
950
+ writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
951
+ /**
952
+ * Sends a HTTP/1.1 102 Processing message to the client, indicating that
953
+ * the request body should be sent.
954
+ * @since v10.0.0
955
+ */
956
+ writeProcessing(callback?: () => void): void;
957
+ }
958
+ interface InformationEvent {
959
+ statusCode: number;
960
+ statusMessage: string;
961
+ httpVersion: string;
962
+ httpVersionMajor: number;
963
+ httpVersionMinor: number;
964
+ headers: IncomingHttpHeaders;
965
+ rawHeaders: string[];
966
+ }
967
+ /**
968
+ * This object is created internally and returned from {@link request}. It
969
+ * represents an _in-progress_ request whose header has already been queued. The
970
+ * header is still mutable using the `setHeader(name, value)`, `getHeader(name)`, `removeHeader(name)` API. The actual header will
971
+ * be sent along with the first data chunk or when calling `request.end()`.
972
+ *
973
+ * To get the response, add a listener for `'response'` to the request object. `'response'` will be emitted from the request object when the response
974
+ * headers have been received. The `'response'` event is executed with one
975
+ * argument which is an instance of {@link IncomingMessage}.
976
+ *
977
+ * During the `'response'` event, one can add listeners to the
978
+ * response object; particularly to listen for the `'data'` event.
979
+ *
980
+ * If no `'response'` handler is added, then the response will be
981
+ * entirely discarded. However, if a `'response'` event handler is added,
982
+ * then the data from the response object **must** be consumed, either by
983
+ * calling `response.read()` whenever there is a `'readable'` event, or
984
+ * by adding a `'data'` handler, or by calling the `.resume()` method.
985
+ * Until the data is consumed, the `'end'` event will not fire. Also, until
986
+ * the data is read it will consume memory that can eventually lead to a
987
+ * 'process out of memory' error.
988
+ *
989
+ * For backward compatibility, `res` will only emit `'error'` if there is an `'error'` listener registered.
990
+ *
991
+ * Set `Content-Length` header to limit the response body size.
992
+ * If `response.strictContentLength` is set to `true`, mismatching the `Content-Length` header value will result in an `Error` being thrown,
993
+ * identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`.
994
+ *
995
+ * `Content-Length` value should be in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes.
996
+ * @since v0.1.17
997
+ */
998
+ class ClientRequest extends OutgoingMessage {
999
+ /**
1000
+ * The `request.aborted` property will be `true` if the request has
1001
+ * been aborted.
1002
+ * @since v0.11.14
1003
+ * @deprecated Since v17.0.0, v16.12.0 - Check `destroyed` instead.
1004
+ */
1005
+ aborted: boolean;
1006
+ /**
1007
+ * The request host.
1008
+ * @since v14.5.0, v12.19.0
1009
+ */
1010
+ host: string;
1011
+ /**
1012
+ * The request protocol.
1013
+ * @since v14.5.0, v12.19.0
1014
+ */
1015
+ protocol: string;
1016
+ /**
1017
+ * When sending request through a keep-alive enabled agent, the underlying socket
1018
+ * might be reused. But if server closes connection at unfortunate time, client
1019
+ * may run into a 'ECONNRESET' error.
1020
+ *
1021
+ * ```js
1022
+ * import http from 'node:http';
1023
+ *
1024
+ * // Server has a 5 seconds keep-alive timeout by default
1025
+ * http
1026
+ * .createServer((req, res) => {
1027
+ * res.write('hello\n');
1028
+ * res.end();
1029
+ * })
1030
+ * .listen(3000);
1031
+ *
1032
+ * setInterval(() => {
1033
+ * // Adapting a keep-alive agent
1034
+ * http.get('http://localhost:3000', { agent }, (res) => {
1035
+ * res.on('data', (data) => {
1036
+ * // Do nothing
1037
+ * });
1038
+ * });
1039
+ * }, 5000); // Sending request on 5s interval so it's easy to hit idle timeout
1040
+ * ```
1041
+ *
1042
+ * By marking a request whether it reused socket or not, we can do
1043
+ * automatic error retry base on it.
1044
+ *
1045
+ * ```js
1046
+ * import http from 'node:http';
1047
+ * const agent = new http.Agent({ keepAlive: true });
1048
+ *
1049
+ * function retriableRequest() {
1050
+ * const req = http
1051
+ * .get('http://localhost:3000', { agent }, (res) => {
1052
+ * // ...
1053
+ * })
1054
+ * .on('error', (err) => {
1055
+ * // Check if retry is needed
1056
+ * if (req.reusedSocket &#x26;&#x26; err.code === 'ECONNRESET') {
1057
+ * retriableRequest();
1058
+ * }
1059
+ * });
1060
+ * }
1061
+ *
1062
+ * retriableRequest();
1063
+ * ```
1064
+ * @since v13.0.0, v12.16.0
1065
+ */
1066
+ reusedSocket: boolean;
1067
+ /**
1068
+ * Limits maximum response headers count. If set to 0, no limit will be applied.
1069
+ */
1070
+ maxHeadersCount: number;
1071
+ constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void);
1072
+ /**
1073
+ * The request method.
1074
+ * @since v0.1.97
1075
+ */
1076
+ method: string;
1077
+ /**
1078
+ * The request path.
1079
+ * @since v0.4.0
1080
+ */
1081
+ path: string;
1082
+ /**
1083
+ * Marks the request as aborting. Calling this will cause remaining data
1084
+ * in the response to be dropped and the socket to be destroyed.
1085
+ * @since v0.3.8
1086
+ * @deprecated Since v14.1.0,v13.14.0 - Use `destroy` instead.
1087
+ */
1088
+ abort(): void;
1089
+ onSocket(socket: Socket): void;
1090
+ /**
1091
+ * Once a socket is assigned to this request and is connected `socket.setTimeout()` will be called.
1092
+ * @since v0.5.9
1093
+ * @param timeout Milliseconds before a request times out.
1094
+ * @param callback Optional function to be called when a timeout occurs. Same as binding to the `'timeout'` event.
1095
+ */
1096
+ setTimeout(timeout: number, callback?: () => void): this;
1097
+ /**
1098
+ * Once a socket is assigned to this request and is connected `socket.setNoDelay()` will be called.
1099
+ * @since v0.5.9
1100
+ */
1101
+ setNoDelay(noDelay?: boolean): void;
1102
+ /**
1103
+ * Once a socket is assigned to this request and is connected `socket.setKeepAlive()` will be called.
1104
+ * @since v0.5.9
1105
+ */
1106
+ setSocketKeepAlive(enable?: boolean, initialDelay?: number): void;
1107
+ /**
1108
+ * Returns an array containing the unique names of the current outgoing raw
1109
+ * headers. Header names are returned with their exact casing being set.
1110
+ *
1111
+ * ```js
1112
+ * request.setHeader('Foo', 'bar');
1113
+ * request.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);
1114
+ *
1115
+ * const headerNames = request.getRawHeaderNames();
1116
+ * // headerNames === ['Foo', 'Set-Cookie']
1117
+ * ```
1118
+ * @since v15.13.0, v14.17.0
1119
+ */
1120
+ getRawHeaderNames(): string[];
1121
+ /**
1122
+ * @deprecated
1123
+ */
1124
+ addListener(event: "abort", listener: () => void): this;
1125
+ addListener(
1126
+ event: "connect",
1127
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1128
+ ): this;
1129
+ addListener(event: "continue", listener: () => void): this;
1130
+ addListener(event: "information", listener: (info: InformationEvent) => void): this;
1131
+ addListener(event: "response", listener: (response: IncomingMessage) => void): this;
1132
+ addListener(event: "socket", listener: (socket: Socket) => void): this;
1133
+ addListener(event: "timeout", listener: () => void): this;
1134
+ addListener(
1135
+ event: "upgrade",
1136
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1137
+ ): this;
1138
+ addListener(event: "close", listener: () => void): this;
1139
+ addListener(event: "drain", listener: () => void): this;
1140
+ addListener(event: "error", listener: (err: Error) => void): this;
1141
+ addListener(event: "finish", listener: () => void): this;
1142
+ addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
1143
+ addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
1144
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
1145
+ /**
1146
+ * @deprecated
1147
+ */
1148
+ on(event: "abort", listener: () => void): this;
1149
+ on(
1150
+ event: "connect",
1151
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1152
+ ): this;
1153
+ on(event: "continue", listener: () => void): this;
1154
+ on(event: "information", listener: (info: InformationEvent) => void): this;
1155
+ on(event: "response", listener: (response: IncomingMessage) => void): this;
1156
+ on(event: "socket", listener: (socket: Socket) => void): this;
1157
+ on(event: "timeout", listener: () => void): this;
1158
+ on(
1159
+ event: "upgrade",
1160
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1161
+ ): this;
1162
+ on(event: "close", listener: () => void): this;
1163
+ on(event: "drain", listener: () => void): this;
1164
+ on(event: "error", listener: (err: Error) => void): this;
1165
+ on(event: "finish", listener: () => void): this;
1166
+ on(event: "pipe", listener: (src: stream.Readable) => void): this;
1167
+ on(event: "unpipe", listener: (src: stream.Readable) => void): this;
1168
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
1169
+ /**
1170
+ * @deprecated
1171
+ */
1172
+ once(event: "abort", listener: () => void): this;
1173
+ once(
1174
+ event: "connect",
1175
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1176
+ ): this;
1177
+ once(event: "continue", listener: () => void): this;
1178
+ once(event: "information", listener: (info: InformationEvent) => void): this;
1179
+ once(event: "response", listener: (response: IncomingMessage) => void): this;
1180
+ once(event: "socket", listener: (socket: Socket) => void): this;
1181
+ once(event: "timeout", listener: () => void): this;
1182
+ once(
1183
+ event: "upgrade",
1184
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1185
+ ): this;
1186
+ once(event: "close", listener: () => void): this;
1187
+ once(event: "drain", listener: () => void): this;
1188
+ once(event: "error", listener: (err: Error) => void): this;
1189
+ once(event: "finish", listener: () => void): this;
1190
+ once(event: "pipe", listener: (src: stream.Readable) => void): this;
1191
+ once(event: "unpipe", listener: (src: stream.Readable) => void): this;
1192
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
1193
+ /**
1194
+ * @deprecated
1195
+ */
1196
+ prependListener(event: "abort", listener: () => void): this;
1197
+ prependListener(
1198
+ event: "connect",
1199
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1200
+ ): this;
1201
+ prependListener(event: "continue", listener: () => void): this;
1202
+ prependListener(event: "information", listener: (info: InformationEvent) => void): this;
1203
+ prependListener(event: "response", listener: (response: IncomingMessage) => void): this;
1204
+ prependListener(event: "socket", listener: (socket: Socket) => void): this;
1205
+ prependListener(event: "timeout", listener: () => void): this;
1206
+ prependListener(
1207
+ event: "upgrade",
1208
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1209
+ ): this;
1210
+ prependListener(event: "close", listener: () => void): this;
1211
+ prependListener(event: "drain", listener: () => void): this;
1212
+ prependListener(event: "error", listener: (err: Error) => void): this;
1213
+ prependListener(event: "finish", listener: () => void): this;
1214
+ prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
1215
+ prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
1216
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
1217
+ /**
1218
+ * @deprecated
1219
+ */
1220
+ prependOnceListener(event: "abort", listener: () => void): this;
1221
+ prependOnceListener(
1222
+ event: "connect",
1223
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1224
+ ): this;
1225
+ prependOnceListener(event: "continue", listener: () => void): this;
1226
+ prependOnceListener(event: "information", listener: (info: InformationEvent) => void): this;
1227
+ prependOnceListener(event: "response", listener: (response: IncomingMessage) => void): this;
1228
+ prependOnceListener(event: "socket", listener: (socket: Socket) => void): this;
1229
+ prependOnceListener(event: "timeout", listener: () => void): this;
1230
+ prependOnceListener(
1231
+ event: "upgrade",
1232
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1233
+ ): this;
1234
+ prependOnceListener(event: "close", listener: () => void): this;
1235
+ prependOnceListener(event: "drain", listener: () => void): this;
1236
+ prependOnceListener(event: "error", listener: (err: Error) => void): this;
1237
+ prependOnceListener(event: "finish", listener: () => void): this;
1238
+ prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
1239
+ prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
1240
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
1241
+ }
1242
+ /**
1243
+ * An `IncomingMessage` object is created by {@link Server} or {@link ClientRequest} and passed as the first argument to the `'request'` and `'response'` event respectively. It may be used to
1244
+ * access response
1245
+ * status, headers, and data.
1246
+ *
1247
+ * Different from its `socket` value which is a subclass of `stream.Duplex`, the `IncomingMessage` itself extends `stream.Readable` and is created separately to
1248
+ * parse and emit the incoming HTTP headers and payload, as the underlying socket
1249
+ * may be reused multiple times in case of keep-alive.
1250
+ * @since v0.1.17
1251
+ */
1252
+ class IncomingMessage extends stream.Readable {
1253
+ constructor(socket: Socket);
1254
+ /**
1255
+ * The `message.aborted` property will be `true` if the request has
1256
+ * been aborted.
1257
+ * @since v10.1.0
1258
+ * @deprecated Since v17.0.0,v16.12.0 - Check `message.destroyed` from <a href="stream.html#class-streamreadable" class="type">stream.Readable</a>.
1259
+ */
1260
+ aborted: boolean;
1261
+ /**
1262
+ * In case of server request, the HTTP version sent by the client. In the case of
1263
+ * client response, the HTTP version of the connected-to server.
1264
+ * Probably either `'1.1'` or `'1.0'`.
1265
+ *
1266
+ * Also `message.httpVersionMajor` is the first integer and `message.httpVersionMinor` is the second.
1267
+ * @since v0.1.1
1268
+ */
1269
+ httpVersion: string;
1270
+ httpVersionMajor: number;
1271
+ httpVersionMinor: number;
1272
+ /**
1273
+ * The `message.complete` property will be `true` if a complete HTTP message has
1274
+ * been received and successfully parsed.
1275
+ *
1276
+ * This property is particularly useful as a means of determining if a client or
1277
+ * server fully transmitted a message before a connection was terminated:
1278
+ *
1279
+ * ```js
1280
+ * const req = http.request({
1281
+ * host: '127.0.0.1',
1282
+ * port: 8080,
1283
+ * method: 'POST',
1284
+ * }, (res) => {
1285
+ * res.resume();
1286
+ * res.on('end', () => {
1287
+ * if (!res.complete)
1288
+ * console.error(
1289
+ * 'The connection was terminated while the message was still being sent');
1290
+ * });
1291
+ * });
1292
+ * ```
1293
+ * @since v0.3.0
1294
+ */
1295
+ complete: boolean;
1296
+ /**
1297
+ * Alias for `message.socket`.
1298
+ * @since v0.1.90
1299
+ * @deprecated Since v16.0.0 - Use `socket`.
1300
+ */
1301
+ connection: Socket;
1302
+ /**
1303
+ * The `net.Socket` object associated with the connection.
1304
+ *
1305
+ * With HTTPS support, use `request.socket.getPeerCertificate()` to obtain the
1306
+ * client's authentication details.
1307
+ *
1308
+ * This property is guaranteed to be an instance of the `net.Socket` class,
1309
+ * a subclass of `stream.Duplex`, unless the user specified a socket
1310
+ * type other than `net.Socket` or internally nulled.
1311
+ * @since v0.3.0
1312
+ */
1313
+ socket: Socket;
1314
+ /**
1315
+ * The request/response headers object.
1316
+ *
1317
+ * Key-value pairs of header names and values. Header names are lower-cased.
1318
+ *
1319
+ * ```js
1320
+ * // Prints something like:
1321
+ * //
1322
+ * // { 'user-agent': 'curl/7.22.0',
1323
+ * // host: '127.0.0.1:8000',
1324
+ * // accept: '*' }
1325
+ * console.log(request.headers);
1326
+ * ```
1327
+ *
1328
+ * Duplicates in raw headers are handled in the following ways, depending on the
1329
+ * header name:
1330
+ *
1331
+ * * Duplicates of `age`, `authorization`, `content-length`, `content-type`, `etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`, `last-modified`, `location`,
1332
+ * `max-forwards`, `proxy-authorization`, `referer`, `retry-after`, `server`, or `user-agent` are discarded.
1333
+ * To allow duplicate values of the headers listed above to be joined,
1334
+ * use the option `joinDuplicateHeaders` in {@link request} and {@link createServer}. See RFC 9110 Section 5.3 for more
1335
+ * information.
1336
+ * * `set-cookie` is always an array. Duplicates are added to the array.
1337
+ * * For duplicate `cookie` headers, the values are joined together with `; `.
1338
+ * * For all other headers, the values are joined together with `, `.
1339
+ * @since v0.1.5
1340
+ */
1341
+ headers: IncomingHttpHeaders;
1342
+ /**
1343
+ * Similar to `message.headers`, but there is no join logic and the values are
1344
+ * always arrays of strings, even for headers received just once.
1345
+ *
1346
+ * ```js
1347
+ * // Prints something like:
1348
+ * //
1349
+ * // { 'user-agent': ['curl/7.22.0'],
1350
+ * // host: ['127.0.0.1:8000'],
1351
+ * // accept: ['*'] }
1352
+ * console.log(request.headersDistinct);
1353
+ * ```
1354
+ * @since v18.3.0, v16.17.0
1355
+ */
1356
+ headersDistinct: NodeJS.Dict<string[]>;
1357
+ /**
1358
+ * The raw request/response headers list exactly as they were received.
1359
+ *
1360
+ * The keys and values are in the same list. It is _not_ a
1361
+ * list of tuples. So, the even-numbered offsets are key values, and the
1362
+ * odd-numbered offsets are the associated values.
1363
+ *
1364
+ * Header names are not lowercased, and duplicates are not merged.
1365
+ *
1366
+ * ```js
1367
+ * // Prints something like:
1368
+ * //
1369
+ * // [ 'user-agent',
1370
+ * // 'this is invalid because there can be only one',
1371
+ * // 'User-Agent',
1372
+ * // 'curl/7.22.0',
1373
+ * // 'Host',
1374
+ * // '127.0.0.1:8000',
1375
+ * // 'ACCEPT',
1376
+ * // '*' ]
1377
+ * console.log(request.rawHeaders);
1378
+ * ```
1379
+ * @since v0.11.6
1380
+ */
1381
+ rawHeaders: string[];
1382
+ /**
1383
+ * The request/response trailers object. Only populated at the `'end'` event.
1384
+ * @since v0.3.0
1385
+ */
1386
+ trailers: NodeJS.Dict<string>;
1387
+ /**
1388
+ * Similar to `message.trailers`, but there is no join logic and the values are
1389
+ * always arrays of strings, even for headers received just once.
1390
+ * Only populated at the `'end'` event.
1391
+ * @since v18.3.0, v16.17.0
1392
+ */
1393
+ trailersDistinct: NodeJS.Dict<string[]>;
1394
+ /**
1395
+ * The raw request/response trailer keys and values exactly as they were
1396
+ * received. Only populated at the `'end'` event.
1397
+ * @since v0.11.6
1398
+ */
1399
+ rawTrailers: string[];
1400
+ /**
1401
+ * Calls `message.socket.setTimeout(msecs, callback)`.
1402
+ * @since v0.5.9
1403
+ */
1404
+ setTimeout(msecs: number, callback?: () => void): this;
1405
+ /**
1406
+ * **Only valid for request obtained from {@link Server}.**
1407
+ *
1408
+ * The request method as a string. Read only. Examples: `'GET'`, `'DELETE'`.
1409
+ * @since v0.1.1
1410
+ */
1411
+ method?: string | undefined;
1412
+ /**
1413
+ * **Only valid for request obtained from {@link Server}.**
1414
+ *
1415
+ * Request URL string. This contains only the URL that is present in the actual
1416
+ * HTTP request. Take the following request:
1417
+ *
1418
+ * ```http
1419
+ * GET /status?name=ryan HTTP/1.1
1420
+ * Accept: text/plain
1421
+ * ```
1422
+ *
1423
+ * To parse the URL into its parts:
1424
+ *
1425
+ * ```js
1426
+ * new URL(`http://${process.env.HOST ?? 'localhost'}${request.url}`);
1427
+ * ```
1428
+ *
1429
+ * When `request.url` is `'/status?name=ryan'` and `process.env.HOST` is undefined:
1430
+ *
1431
+ * ```console
1432
+ * $ node
1433
+ * > new URL(`http://${process.env.HOST ?? 'localhost'}${request.url}`);
1434
+ * URL {
1435
+ * href: 'http://localhost/status?name=ryan',
1436
+ * origin: 'http://localhost',
1437
+ * protocol: 'http:',
1438
+ * username: '',
1439
+ * password: '',
1440
+ * host: 'localhost',
1441
+ * hostname: 'localhost',
1442
+ * port: '',
1443
+ * pathname: '/status',
1444
+ * search: '?name=ryan',
1445
+ * searchParams: URLSearchParams { 'name' => 'ryan' },
1446
+ * hash: ''
1447
+ * }
1448
+ * ```
1449
+ *
1450
+ * Ensure that you set `process.env.HOST` to the server's host name, or consider replacing this part entirely. If using `req.headers.host`, ensure proper
1451
+ * validation is used, as clients may specify a custom `Host` header.
1452
+ * @since v0.1.90
1453
+ */
1454
+ url?: string | undefined;
1455
+ /**
1456
+ * **Only valid for response obtained from {@link ClientRequest}.**
1457
+ *
1458
+ * The 3-digit HTTP response status code. E.G. `404`.
1459
+ * @since v0.1.1
1460
+ */
1461
+ statusCode?: number | undefined;
1462
+ /**
1463
+ * **Only valid for response obtained from {@link ClientRequest}.**
1464
+ *
1465
+ * The HTTP response status message (reason phrase). E.G. `OK` or `Internal Server Error`.
1466
+ * @since v0.11.10
1467
+ */
1468
+ statusMessage?: string | undefined;
1469
+ /**
1470
+ * Calls `destroy()` on the socket that received the `IncomingMessage`. If `error` is provided, an `'error'` event is emitted on the socket and `error` is passed
1471
+ * as an argument to any listeners on the event.
1472
+ * @since v0.3.0
1473
+ */
1474
+ destroy(error?: Error): this;
1475
+ }
1476
+ interface ProxyEnv extends NodeJS.ProcessEnv {
1477
+ HTTP_PROXY?: string | undefined;
1478
+ HTTPS_PROXY?: string | undefined;
1479
+ NO_PROXY?: string | undefined;
1480
+ http_proxy?: string | undefined;
1481
+ https_proxy?: string | undefined;
1482
+ no_proxy?: string | undefined;
1483
+ }
1484
+ interface AgentOptions extends NodeJS.PartialOptions<TcpSocketConnectOpts> {
1485
+ /**
1486
+ * Keep sockets around in a pool to be used by other requests in the future. Default = false
1487
+ */
1488
+ keepAlive?: boolean | undefined;
1489
+ /**
1490
+ * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000.
1491
+ * Only relevant if keepAlive is set to true.
1492
+ */
1493
+ keepAliveMsecs?: number | undefined;
1494
+ /**
1495
+ * Milliseconds to subtract from
1496
+ * the server-provided `keep-alive: timeout=...` hint when determining socket
1497
+ * expiration time. This buffer helps ensure the agent closes the socket
1498
+ * slightly before the server does, reducing the chance of sending a request
1499
+ * on a socket that’s about to be closed by the server.
1500
+ * @since v24.7.0
1501
+ * @default 1000
1502
+ */
1503
+ agentKeepAliveTimeoutBuffer?: number | undefined;
1504
+ /**
1505
+ * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
1506
+ */
1507
+ maxSockets?: number | undefined;
1508
+ /**
1509
+ * Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity.
1510
+ */
1511
+ maxTotalSockets?: number | undefined;
1512
+ /**
1513
+ * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256.
1514
+ */
1515
+ maxFreeSockets?: number | undefined;
1516
+ /**
1517
+ * Socket timeout in milliseconds. This will set the timeout after the socket is connected.
1518
+ */
1519
+ timeout?: number | undefined;
1520
+ /**
1521
+ * Scheduling strategy to apply when picking the next free socket to use.
1522
+ * @default `lifo`
1523
+ */
1524
+ scheduling?: "fifo" | "lifo" | undefined;
1525
+ /**
1526
+ * Environment variables for proxy configuration. See
1527
+ * [Built-in Proxy Support](https://nodejs.org/docs/latest-v24.x/api/http.html#built-in-proxy-support) for details.
1528
+ * @since v24.5.0
1529
+ */
1530
+ proxyEnv?: ProxyEnv | undefined;
1531
+ /**
1532
+ * Default port to use when the port is not specified in requests.
1533
+ * @since v24.5.0
1534
+ */
1535
+ defaultPort?: number | undefined;
1536
+ /**
1537
+ * The protocol to use for the agent.
1538
+ * @since v24.5.0
1539
+ */
1540
+ protocol?: string | undefined;
1541
+ }
1542
+ /**
1543
+ * An `Agent` is responsible for managing connection persistence
1544
+ * and reuse for HTTP clients. It maintains a queue of pending requests
1545
+ * for a given host and port, reusing a single socket connection for each
1546
+ * until the queue is empty, at which time the socket is either destroyed
1547
+ * or put into a pool where it is kept to be used again for requests to the
1548
+ * same host and port. Whether it is destroyed or pooled depends on the `keepAlive` `option`.
1549
+ *
1550
+ * Pooled connections have TCP Keep-Alive enabled for them, but servers may
1551
+ * still close idle connections, in which case they will be removed from the
1552
+ * pool and a new connection will be made when a new HTTP request is made for
1553
+ * that host and port. Servers may also refuse to allow multiple requests
1554
+ * over the same connection, in which case the connection will have to be
1555
+ * remade for every request and cannot be pooled. The `Agent` will still make
1556
+ * the requests to that server, but each one will occur over a new connection.
1557
+ *
1558
+ * When a connection is closed by the client or the server, it is removed
1559
+ * from the pool. Any unused sockets in the pool will be unrefed so as not
1560
+ * to keep the Node.js process running when there are no outstanding requests.
1561
+ * (see `socket.unref()`).
1562
+ *
1563
+ * It is good practice, to `destroy()` an `Agent` instance when it is no
1564
+ * longer in use, because unused sockets consume OS resources.
1565
+ *
1566
+ * Sockets are removed from an agent when the socket emits either
1567
+ * a `'close'` event or an `'agentRemove'` event. When intending to keep one
1568
+ * HTTP request open for a long time without keeping it in the agent, something
1569
+ * like the following may be done:
1570
+ *
1571
+ * ```js
1572
+ * http.get(options, (res) => {
1573
+ * // Do stuff
1574
+ * }).on('socket', (socket) => {
1575
+ * socket.emit('agentRemove');
1576
+ * });
1577
+ * ```
1578
+ *
1579
+ * An agent may also be used for an individual request. By providing `{agent: false}` as an option to the `http.get()` or `http.request()` functions, a one-time use `Agent` with default options
1580
+ * will be used
1581
+ * for the client connection.
1582
+ *
1583
+ * `agent:false`:
1584
+ *
1585
+ * ```js
1586
+ * http.get({
1587
+ * hostname: 'localhost',
1588
+ * port: 80,
1589
+ * path: '/',
1590
+ * agent: false, // Create a new agent just for this one request
1591
+ * }, (res) => {
1592
+ * // Do stuff with response
1593
+ * });
1594
+ * ```
1595
+ *
1596
+ * `options` in [`socket.connect()`](https://nodejs.org/docs/latest-v24.x/api/net.html#socketconnectoptions-connectlistener) are also supported.
1597
+ *
1598
+ * To configure any of them, a custom {@link Agent} instance must be created.
1599
+ *
1600
+ * ```js
1601
+ * import http from 'node:http';
1602
+ * const keepAliveAgent = new http.Agent({ keepAlive: true });
1603
+ * options.agent = keepAliveAgent;
1604
+ * http.request(options, onResponseCallback)
1605
+ * ```
1606
+ * @since v0.3.4
1607
+ */
1608
+ class Agent extends EventEmitter {
1609
+ /**
1610
+ * By default set to 256. For agents with `keepAlive` enabled, this
1611
+ * sets the maximum number of sockets that will be left open in the free
1612
+ * state.
1613
+ * @since v0.11.7
1614
+ */
1615
+ maxFreeSockets: number;
1616
+ /**
1617
+ * By default set to `Infinity`. Determines how many concurrent sockets the agent
1618
+ * can have open per origin. Origin is the returned value of `agent.getName()`.
1619
+ * @since v0.3.6
1620
+ */
1621
+ maxSockets: number;
1622
+ /**
1623
+ * By default set to `Infinity`. Determines how many concurrent sockets the agent
1624
+ * can have open. Unlike `maxSockets`, this parameter applies across all origins.
1625
+ * @since v14.5.0, v12.19.0
1626
+ */
1627
+ maxTotalSockets: number;
1628
+ /**
1629
+ * An object which contains arrays of sockets currently awaiting use by
1630
+ * the agent when `keepAlive` is enabled. Do not modify.
1631
+ *
1632
+ * Sockets in the `freeSockets` list will be automatically destroyed and
1633
+ * removed from the array on `'timeout'`.
1634
+ * @since v0.11.4
1635
+ */
1636
+ readonly freeSockets: NodeJS.ReadOnlyDict<Socket[]>;
1637
+ /**
1638
+ * An object which contains arrays of sockets currently in use by the
1639
+ * agent. Do not modify.
1640
+ * @since v0.3.6
1641
+ */
1642
+ readonly sockets: NodeJS.ReadOnlyDict<Socket[]>;
1643
+ /**
1644
+ * An object which contains queues of requests that have not yet been assigned to
1645
+ * sockets. Do not modify.
1646
+ * @since v0.5.9
1647
+ */
1648
+ readonly requests: NodeJS.ReadOnlyDict<IncomingMessage[]>;
1649
+ constructor(opts?: AgentOptions);
1650
+ /**
1651
+ * Destroy any sockets that are currently in use by the agent.
1652
+ *
1653
+ * It is usually not necessary to do this. However, if using an
1654
+ * agent with `keepAlive` enabled, then it is best to explicitly shut down
1655
+ * the agent when it is no longer needed. Otherwise,
1656
+ * sockets might stay open for quite a long time before the server
1657
+ * terminates them.
1658
+ * @since v0.11.4
1659
+ */
1660
+ destroy(): void;
1661
+ /**
1662
+ * Produces a socket/stream to be used for HTTP requests.
1663
+ *
1664
+ * By default, this function is the same as `net.createConnection()`. However,
1665
+ * custom agents may override this method in case greater flexibility is desired.
1666
+ *
1667
+ * A socket/stream can be supplied in one of two ways: by returning the
1668
+ * socket/stream from this function, or by passing the socket/stream to `callback`.
1669
+ *
1670
+ * This method is guaranteed to return an instance of the `net.Socket` class,
1671
+ * a subclass of `stream.Duplex`, unless the user specifies a socket
1672
+ * type other than `net.Socket`.
1673
+ *
1674
+ * `callback` has a signature of `(err, stream)`.
1675
+ * @since v0.11.4
1676
+ * @param options Options containing connection details. Check `createConnection` for the format of the options
1677
+ * @param callback Callback function that receives the created socket
1678
+ */
1679
+ createConnection(
1680
+ options: ClientRequestArgs,
1681
+ callback?: (err: Error | null, stream: stream.Duplex) => void,
1682
+ ): stream.Duplex | null | undefined;
1683
+ /**
1684
+ * Called when `socket` is detached from a request and could be persisted by the`Agent`. Default behavior is to:
1685
+ *
1686
+ * ```js
1687
+ * socket.setKeepAlive(true, this.keepAliveMsecs);
1688
+ * socket.unref();
1689
+ * return true;
1690
+ * ```
1691
+ *
1692
+ * This method can be overridden by a particular `Agent` subclass. If this
1693
+ * method returns a falsy value, the socket will be destroyed instead of persisting
1694
+ * it for use with the next request.
1695
+ *
1696
+ * The `socket` argument can be an instance of `net.Socket`, a subclass of `stream.Duplex`.
1697
+ * @since v8.1.0
1698
+ */
1699
+ keepSocketAlive(socket: stream.Duplex): void;
1700
+ /**
1701
+ * Called when `socket` is attached to `request` after being persisted because of
1702
+ * the keep-alive options. Default behavior is to:
1703
+ *
1704
+ * ```js
1705
+ * socket.ref();
1706
+ * ```
1707
+ *
1708
+ * This method can be overridden by a particular `Agent` subclass.
1709
+ *
1710
+ * The `socket` argument can be an instance of `net.Socket`, a subclass of `stream.Duplex`.
1711
+ * @since v8.1.0
1712
+ */
1713
+ reuseSocket(socket: stream.Duplex, request: ClientRequest): void;
1714
+ /**
1715
+ * Get a unique name for a set of request options, to determine whether a
1716
+ * connection can be reused. For an HTTP agent, this returns`host:port:localAddress` or `host:port:localAddress:family`. For an HTTPS agent,
1717
+ * the name includes the CA, cert, ciphers, and other HTTPS/TLS-specific options
1718
+ * that determine socket reusability.
1719
+ * @since v0.11.4
1720
+ * @param options A set of options providing information for name generation
1721
+ */
1722
+ getName(options?: ClientRequestArgs): string;
1723
+ }
1724
+ const METHODS: string[];
1725
+ const STATUS_CODES: {
1726
+ [errorCode: number]: string | undefined;
1727
+ [errorCode: string]: string | undefined;
1728
+ };
1729
+ /**
1730
+ * Returns a new instance of {@link Server}.
1731
+ *
1732
+ * The `requestListener` is a function which is automatically
1733
+ * added to the `'request'` event.
1734
+ *
1735
+ * ```js
1736
+ * import http from 'node:http';
1737
+ *
1738
+ * // Create a local server to receive data from
1739
+ * const server = http.createServer((req, res) => {
1740
+ * res.writeHead(200, { 'Content-Type': 'application/json' });
1741
+ * res.end(JSON.stringify({
1742
+ * data: 'Hello World!',
1743
+ * }));
1744
+ * });
1745
+ *
1746
+ * server.listen(8000);
1747
+ * ```
1748
+ *
1749
+ * ```js
1750
+ * import http from 'node:http';
1751
+ *
1752
+ * // Create a local server to receive data from
1753
+ * const server = http.createServer();
1754
+ *
1755
+ * // Listen to the request event
1756
+ * server.on('request', (request, res) => {
1757
+ * res.writeHead(200, { 'Content-Type': 'application/json' });
1758
+ * res.end(JSON.stringify({
1759
+ * data: 'Hello World!',
1760
+ * }));
1761
+ * });
1762
+ *
1763
+ * server.listen(8000);
1764
+ * ```
1765
+ * @since v0.1.13
1766
+ */
1767
+ function createServer<
1768
+ Request extends typeof IncomingMessage = typeof IncomingMessage,
1769
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
1770
+ >(requestListener?: RequestListener<Request, Response>): Server<Request, Response>;
1771
+ function createServer<
1772
+ Request extends typeof IncomingMessage = typeof IncomingMessage,
1773
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
1774
+ >(
1775
+ options: ServerOptions<Request, Response>,
1776
+ requestListener?: RequestListener<Request, Response>,
1777
+ ): Server<Request, Response>;
1778
+ // although RequestOptions are passed as ClientRequestArgs to ClientRequest directly,
1779
+ // create interface RequestOptions would make the naming more clear to developers
1780
+ interface RequestOptions extends ClientRequestArgs {}
1781
+ /**
1782
+ * `options` in `socket.connect()` are also supported.
1783
+ *
1784
+ * Node.js maintains several connections per server to make HTTP requests.
1785
+ * This function allows one to transparently issue requests.
1786
+ *
1787
+ * `url` can be a string or a `URL` object. If `url` is a
1788
+ * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
1789
+ *
1790
+ * If both `url` and `options` are specified, the objects are merged, with the `options` properties taking precedence.
1791
+ *
1792
+ * The optional `callback` parameter will be added as a one-time listener for
1793
+ * the `'response'` event.
1794
+ *
1795
+ * `http.request()` returns an instance of the {@link ClientRequest} class. The `ClientRequest` instance is a writable stream. If one needs to
1796
+ * upload a file with a POST request, then write to the `ClientRequest` object.
1797
+ *
1798
+ * ```js
1799
+ * import http from 'node:http';
1800
+ * import { Buffer } from 'node:buffer';
1801
+ *
1802
+ * const postData = JSON.stringify({
1803
+ * 'msg': 'Hello World!',
1804
+ * });
1805
+ *
1806
+ * const options = {
1807
+ * hostname: 'www.google.com',
1808
+ * port: 80,
1809
+ * path: '/upload',
1810
+ * method: 'POST',
1811
+ * headers: {
1812
+ * 'Content-Type': 'application/json',
1813
+ * 'Content-Length': Buffer.byteLength(postData),
1814
+ * },
1815
+ * };
1816
+ *
1817
+ * const req = http.request(options, (res) => {
1818
+ * console.log(`STATUS: ${res.statusCode}`);
1819
+ * console.log(`HEADERS: ${JSON.stringify(res.headers)}`);
1820
+ * res.setEncoding('utf8');
1821
+ * res.on('data', (chunk) => {
1822
+ * console.log(`BODY: ${chunk}`);
1823
+ * });
1824
+ * res.on('end', () => {
1825
+ * console.log('No more data in response.');
1826
+ * });
1827
+ * });
1828
+ *
1829
+ * req.on('error', (e) => {
1830
+ * console.error(`problem with request: ${e.message}`);
1831
+ * });
1832
+ *
1833
+ * // Write data to request body
1834
+ * req.write(postData);
1835
+ * req.end();
1836
+ * ```
1837
+ *
1838
+ * In the example `req.end()` was called. With `http.request()` one
1839
+ * must always call `req.end()` to signify the end of the request -
1840
+ * even if there is no data being written to the request body.
1841
+ *
1842
+ * If any error is encountered during the request (be that with DNS resolution,
1843
+ * TCP level errors, or actual HTTP parse errors) an `'error'` event is emitted
1844
+ * on the returned request object. As with all `'error'` events, if no listeners
1845
+ * are registered the error will be thrown.
1846
+ *
1847
+ * There are a few special headers that should be noted.
1848
+ *
1849
+ * * Sending a 'Connection: keep-alive' will notify Node.js that the connection to
1850
+ * the server should be persisted until the next request.
1851
+ * * Sending a 'Content-Length' header will disable the default chunked encoding.
1852
+ * * Sending an 'Expect' header will immediately send the request headers.
1853
+ * Usually, when sending 'Expect: 100-continue', both a timeout and a listener
1854
+ * for the `'continue'` event should be set. See RFC 2616 Section 8.2.3 for more
1855
+ * information.
1856
+ * * Sending an Authorization header will override using the `auth` option
1857
+ * to compute basic authentication.
1858
+ *
1859
+ * Example using a `URL` as `options`:
1860
+ *
1861
+ * ```js
1862
+ * const options = new URL('http://abc:xyz@example.com');
1863
+ *
1864
+ * const req = http.request(options, (res) => {
1865
+ * // ...
1866
+ * });
1867
+ * ```
1868
+ *
1869
+ * In a successful request, the following events will be emitted in the following
1870
+ * order:
1871
+ *
1872
+ * * `'socket'`
1873
+ * * `'response'`
1874
+ * * `'data'` any number of times, on the `res` object
1875
+ * (`'data'` will not be emitted at all if the response body is empty, for
1876
+ * instance, in most redirects)
1877
+ * * `'end'` on the `res` object
1878
+ * * `'close'`
1879
+ *
1880
+ * In the case of a connection error, the following events will be emitted:
1881
+ *
1882
+ * * `'socket'`
1883
+ * * `'error'`
1884
+ * * `'close'`
1885
+ *
1886
+ * In the case of a premature connection close before the response is received,
1887
+ * the following events will be emitted in the following order:
1888
+ *
1889
+ * * `'socket'`
1890
+ * * `'error'` with an error with message `'Error: socket hang up'` and code `'ECONNRESET'`
1891
+ * * `'close'`
1892
+ *
1893
+ * In the case of a premature connection close after the response is received,
1894
+ * the following events will be emitted in the following order:
1895
+ *
1896
+ * * `'socket'`
1897
+ * * `'response'`
1898
+ * * `'data'` any number of times, on the `res` object
1899
+ * * (connection closed here)
1900
+ * * `'aborted'` on the `res` object
1901
+ * * `'close'`
1902
+ * * `'error'` on the `res` object with an error with message `'Error: aborted'` and code `'ECONNRESET'`
1903
+ * * `'close'` on the `res` object
1904
+ *
1905
+ * If `req.destroy()` is called before a socket is assigned, the following
1906
+ * events will be emitted in the following order:
1907
+ *
1908
+ * * (`req.destroy()` called here)
1909
+ * * `'error'` with an error with message `'Error: socket hang up'` and code `'ECONNRESET'`, or the error with which `req.destroy()` was called
1910
+ * * `'close'`
1911
+ *
1912
+ * If `req.destroy()` is called before the connection succeeds, the following
1913
+ * events will be emitted in the following order:
1914
+ *
1915
+ * * `'socket'`
1916
+ * * (`req.destroy()` called here)
1917
+ * * `'error'` with an error with message `'Error: socket hang up'` and code `'ECONNRESET'`, or the error with which `req.destroy()` was called
1918
+ * * `'close'`
1919
+ *
1920
+ * If `req.destroy()` is called after the response is received, the following
1921
+ * events will be emitted in the following order:
1922
+ *
1923
+ * * `'socket'`
1924
+ * * `'response'`
1925
+ * * `'data'` any number of times, on the `res` object
1926
+ * * (`req.destroy()` called here)
1927
+ * * `'aborted'` on the `res` object
1928
+ * * `'close'`
1929
+ * * `'error'` on the `res` object with an error with message `'Error: aborted'` and code `'ECONNRESET'`, or the error with which `req.destroy()` was called
1930
+ * * `'close'` on the `res` object
1931
+ *
1932
+ * If `req.abort()` is called before a socket is assigned, the following
1933
+ * events will be emitted in the following order:
1934
+ *
1935
+ * * (`req.abort()` called here)
1936
+ * * `'abort'`
1937
+ * * `'close'`
1938
+ *
1939
+ * If `req.abort()` is called before the connection succeeds, the following
1940
+ * events will be emitted in the following order:
1941
+ *
1942
+ * * `'socket'`
1943
+ * * (`req.abort()` called here)
1944
+ * * `'abort'`
1945
+ * * `'error'` with an error with message `'Error: socket hang up'` and code `'ECONNRESET'`
1946
+ * * `'close'`
1947
+ *
1948
+ * If `req.abort()` is called after the response is received, the following
1949
+ * events will be emitted in the following order:
1950
+ *
1951
+ * * `'socket'`
1952
+ * * `'response'`
1953
+ * * `'data'` any number of times, on the `res` object
1954
+ * * (`req.abort()` called here)
1955
+ * * `'abort'`
1956
+ * * `'aborted'` on the `res` object
1957
+ * * `'error'` on the `res` object with an error with message `'Error: aborted'` and code `'ECONNRESET'`.
1958
+ * * `'close'`
1959
+ * * `'close'` on the `res` object
1960
+ *
1961
+ * Setting the `timeout` option or using the `setTimeout()` function will
1962
+ * not abort the request or do anything besides add a `'timeout'` event.
1963
+ *
1964
+ * Passing an `AbortSignal` and then calling `abort()` on the corresponding `AbortController` will behave the same way as calling `.destroy()` on the
1965
+ * request. Specifically, the `'error'` event will be emitted with an error with
1966
+ * the message `'AbortError: The operation was aborted'`, the code `'ABORT_ERR'` and the `cause`, if one was provided.
1967
+ * @since v0.3.6
1968
+ */
1969
+ function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
1970
+ function request(
1971
+ url: string | URL,
1972
+ options: RequestOptions,
1973
+ callback?: (res: IncomingMessage) => void,
1974
+ ): ClientRequest;
1975
+ /**
1976
+ * Since most requests are GET requests without bodies, Node.js provides this
1977
+ * convenience method. The only difference between this method and {@link request} is that it sets the method to GET by default and calls `req.end()` automatically. The callback must take care to
1978
+ * consume the response
1979
+ * data for reasons stated in {@link ClientRequest} section.
1980
+ *
1981
+ * The `callback` is invoked with a single argument that is an instance of {@link IncomingMessage}.
1982
+ *
1983
+ * JSON fetching example:
1984
+ *
1985
+ * ```js
1986
+ * http.get('http://localhost:8000/', (res) => {
1987
+ * const { statusCode } = res;
1988
+ * const contentType = res.headers['content-type'];
1989
+ *
1990
+ * let error;
1991
+ * // Any 2xx status code signals a successful response but
1992
+ * // here we're only checking for 200.
1993
+ * if (statusCode !== 200) {
1994
+ * error = new Error('Request Failed.\n' +
1995
+ * `Status Code: ${statusCode}`);
1996
+ * } else if (!/^application\/json/.test(contentType)) {
1997
+ * error = new Error('Invalid content-type.\n' +
1998
+ * `Expected application/json but received ${contentType}`);
1999
+ * }
2000
+ * if (error) {
2001
+ * console.error(error.message);
2002
+ * // Consume response data to free up memory
2003
+ * res.resume();
2004
+ * return;
2005
+ * }
2006
+ *
2007
+ * res.setEncoding('utf8');
2008
+ * let rawData = '';
2009
+ * res.on('data', (chunk) => { rawData += chunk; });
2010
+ * res.on('end', () => {
2011
+ * try {
2012
+ * const parsedData = JSON.parse(rawData);
2013
+ * console.log(parsedData);
2014
+ * } catch (e) {
2015
+ * console.error(e.message);
2016
+ * }
2017
+ * });
2018
+ * }).on('error', (e) => {
2019
+ * console.error(`Got error: ${e.message}`);
2020
+ * });
2021
+ *
2022
+ * // Create a local server to receive data from
2023
+ * const server = http.createServer((req, res) => {
2024
+ * res.writeHead(200, { 'Content-Type': 'application/json' });
2025
+ * res.end(JSON.stringify({
2026
+ * data: 'Hello World!',
2027
+ * }));
2028
+ * });
2029
+ *
2030
+ * server.listen(8000);
2031
+ * ```
2032
+ * @since v0.3.6
2033
+ * @param options Accepts the same `options` as {@link request}, with the method set to GET by default.
2034
+ */
2035
+ function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
2036
+ function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
2037
+ /**
2038
+ * Performs the low-level validations on the provided `name` that are done when `res.setHeader(name, value)` is called.
2039
+ *
2040
+ * Passing illegal value as `name` will result in a `TypeError` being thrown,
2041
+ * identified by `code: 'ERR_INVALID_HTTP_TOKEN'`.
2042
+ *
2043
+ * It is not necessary to use this method before passing headers to an HTTP request
2044
+ * or response. The HTTP module will automatically validate such headers.
2045
+ *
2046
+ * Example:
2047
+ *
2048
+ * ```js
2049
+ * import { validateHeaderName } from 'node:http';
2050
+ *
2051
+ * try {
2052
+ * validateHeaderName('');
2053
+ * } catch (err) {
2054
+ * console.error(err instanceof TypeError); // --> true
2055
+ * console.error(err.code); // --> 'ERR_INVALID_HTTP_TOKEN'
2056
+ * console.error(err.message); // --> 'Header name must be a valid HTTP token [""]'
2057
+ * }
2058
+ * ```
2059
+ * @since v14.3.0
2060
+ * @param [label='Header name'] Label for error message.
2061
+ */
2062
+ function validateHeaderName(name: string): void;
2063
+ /**
2064
+ * Performs the low-level validations on the provided `value` that are done when `res.setHeader(name, value)` is called.
2065
+ *
2066
+ * Passing illegal value as `value` will result in a `TypeError` being thrown.
2067
+ *
2068
+ * * Undefined value error is identified by `code: 'ERR_HTTP_INVALID_HEADER_VALUE'`.
2069
+ * * Invalid value character error is identified by `code: 'ERR_INVALID_CHAR'`.
2070
+ *
2071
+ * It is not necessary to use this method before passing headers to an HTTP request
2072
+ * or response. The HTTP module will automatically validate such headers.
2073
+ *
2074
+ * Examples:
2075
+ *
2076
+ * ```js
2077
+ * import { validateHeaderValue } from 'node:http';
2078
+ *
2079
+ * try {
2080
+ * validateHeaderValue('x-my-header', undefined);
2081
+ * } catch (err) {
2082
+ * console.error(err instanceof TypeError); // --> true
2083
+ * console.error(err.code === 'ERR_HTTP_INVALID_HEADER_VALUE'); // --> true
2084
+ * console.error(err.message); // --> 'Invalid value "undefined" for header "x-my-header"'
2085
+ * }
2086
+ *
2087
+ * try {
2088
+ * validateHeaderValue('x-my-header', 'oʊmɪɡə');
2089
+ * } catch (err) {
2090
+ * console.error(err instanceof TypeError); // --> true
2091
+ * console.error(err.code === 'ERR_INVALID_CHAR'); // --> true
2092
+ * console.error(err.message); // --> 'Invalid character in header content ["x-my-header"]'
2093
+ * }
2094
+ * ```
2095
+ * @since v14.3.0
2096
+ * @param name Header name
2097
+ * @param value Header value
2098
+ */
2099
+ function validateHeaderValue(name: string, value: string): void;
2100
+ /**
2101
+ * Set the maximum number of idle HTTP parsers.
2102
+ * @since v18.8.0, v16.18.0
2103
+ * @param [max=1000]
2104
+ */
2105
+ function setMaxIdleHTTPParsers(max: number): void;
2106
+ /**
2107
+ * Global instance of `Agent` which is used as the default for all HTTP client
2108
+ * requests. Diverges from a default `Agent` configuration by having `keepAlive`
2109
+ * enabled and a `timeout` of 5 seconds.
2110
+ * @since v0.5.9
2111
+ */
2112
+ let globalAgent: Agent;
2113
+ /**
2114
+ * Read-only property specifying the maximum allowed size of HTTP headers in bytes.
2115
+ * Defaults to 16KB. Configurable using the `--max-http-header-size` CLI option.
2116
+ */
2117
+ const maxHeaderSize: number;
2118
+ /**
2119
+ * A browser-compatible implementation of `WebSocket`.
2120
+ * @since v22.5.0
2121
+ */
2122
+ const WebSocket: typeof import("undici-types").WebSocket;
2123
+ /**
2124
+ * @since v22.5.0
2125
+ */
2126
+ const CloseEvent: typeof import("undici-types").CloseEvent;
2127
+ /**
2128
+ * @since v22.5.0
2129
+ */
2130
+ const MessageEvent: typeof import("undici-types").MessageEvent;
2131
+ }
2132
+ declare module "node:http" {
2133
+ export * from "http";
2134
+ }