cdk-ecr-deployment 2.5.6 → 2.5.21

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 (376) hide show
  1. package/.gitattributes +5 -4
  2. package/.jsii +673 -21
  3. package/.jsii.tabl.json +1 -0
  4. package/.projenrc.ts +100 -0
  5. package/API.md +4 -4
  6. package/README.md +4 -4
  7. package/lambda/go.mod +2 -5
  8. package/lambda/go.sum +39 -14
  9. package/lib/index.d.ts +7 -65
  10. package/lib/index.js +7 -45
  11. package/node_modules/@sindresorhus/is/dist/index.d.ts +12 -7
  12. package/node_modules/@sindresorhus/is/dist/index.js +9 -4
  13. package/node_modules/@sindresorhus/is/dist/types.d.ts +1 -0
  14. package/node_modules/@sindresorhus/is/package.json +1 -1
  15. package/node_modules/@sindresorhus/is/readme.md +25 -7
  16. package/node_modules/@types/cacheable-request/README.md +2 -2
  17. package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +2 -2
  18. package/node_modules/@types/cacheable-request/node_modules/@types/node/assert.d.ts +135 -75
  19. package/node_modules/@types/cacheable-request/node_modules/@types/node/async_hooks.d.ts +67 -38
  20. package/node_modules/@types/cacheable-request/node_modules/@types/node/buffer.d.ts +226 -104
  21. package/node_modules/@types/cacheable-request/node_modules/@types/node/child_process.d.ts +87 -58
  22. package/node_modules/@types/cacheable-request/node_modules/@types/node/cluster.d.ts +29 -29
  23. package/node_modules/@types/cacheable-request/node_modules/@types/node/console.d.ts +5 -5
  24. package/node_modules/@types/cacheable-request/node_modules/@types/node/crypto.d.ts +888 -256
  25. package/node_modules/@types/cacheable-request/node_modules/@types/node/dgram.d.ts +16 -16
  26. package/node_modules/@types/cacheable-request/node_modules/@types/node/diagnostics_channel.d.ts +60 -21
  27. package/node_modules/@types/cacheable-request/node_modules/@types/node/dns/promises.d.ts +52 -8
  28. package/node_modules/@types/cacheable-request/node_modules/@types/node/dns.d.ts +27 -18
  29. package/node_modules/@types/cacheable-request/node_modules/@types/node/dom-events.d.ts +126 -0
  30. package/node_modules/@types/cacheable-request/node_modules/@types/node/domain.d.ts +6 -5
  31. package/node_modules/@types/cacheable-request/node_modules/@types/node/events.d.ts +166 -93
  32. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs/promises.d.ts +169 -70
  33. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +301 -126
  34. package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.d.ts +22 -13
  35. package/node_modules/@types/cacheable-request/node_modules/@types/node/http.d.ts +453 -125
  36. package/node_modules/@types/cacheable-request/node_modules/@types/node/http2.d.ts +74 -46
  37. package/node_modules/@types/cacheable-request/node_modules/@types/node/https.d.ts +103 -53
  38. package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +6 -2
  39. package/node_modules/@types/cacheable-request/node_modules/@types/node/inspector.d.ts +20 -16
  40. package/node_modules/@types/cacheable-request/node_modules/@types/node/module.d.ts +6 -4
  41. package/node_modules/@types/cacheable-request/node_modules/@types/node/net.d.ts +114 -22
  42. package/node_modules/@types/cacheable-request/node_modules/@types/node/os.d.ts +36 -14
  43. package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +15 -3
  44. package/node_modules/@types/cacheable-request/node_modules/@types/node/path.d.ts +37 -26
  45. package/node_modules/@types/cacheable-request/node_modules/@types/node/perf_hooks.d.ts +96 -15
  46. package/node_modules/@types/cacheable-request/node_modules/@types/node/process.d.ts +95 -82
  47. package/node_modules/@types/cacheable-request/node_modules/@types/node/punycode.d.ts +1 -1
  48. package/node_modules/@types/cacheable-request/node_modules/@types/node/querystring.d.ts +6 -6
  49. package/node_modules/@types/cacheable-request/node_modules/@types/node/readline/promises.d.ts +145 -0
  50. package/node_modules/@types/cacheable-request/node_modules/@types/node/readline.d.ts +51 -175
  51. package/node_modules/@types/cacheable-request/node_modules/@types/node/repl.d.ts +21 -21
  52. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/consumers.d.ts +2 -14
  53. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream.d.ts +983 -824
  54. package/node_modules/@types/cacheable-request/node_modules/@types/node/string_decoder.d.ts +6 -6
  55. package/node_modules/@types/cacheable-request/node_modules/@types/node/test.d.ts +1052 -0
  56. package/node_modules/@types/cacheable-request/node_modules/@types/node/timers/promises.d.ts +26 -1
  57. package/node_modules/@types/cacheable-request/node_modules/@types/node/timers.d.ts +127 -6
  58. package/node_modules/@types/cacheable-request/node_modules/@types/node/tls.d.ts +149 -50
  59. package/node_modules/@types/cacheable-request/node_modules/@types/node/trace_events.d.ts +30 -9
  60. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
  61. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/assert.d.ts +972 -0
  62. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/async_hooks.d.ts +530 -0
  63. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/buffer.d.ts +2354 -0
  64. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/child_process.d.ts +1395 -0
  65. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/cluster.d.ts +414 -0
  66. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/console.d.ts +412 -0
  67. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
  68. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/crypto.d.ts +3969 -0
  69. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
  70. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +191 -0
  71. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/dns/promises.d.ts +414 -0
  72. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/dns.d.ts +668 -0
  73. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/dom-events.d.ts +126 -0
  74. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
  75. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/events.d.ts +724 -0
  76. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/fs/promises.d.ts +1189 -0
  77. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/fs.d.ts +4044 -0
  78. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/globals.d.ts +303 -0
  79. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
  80. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/http.d.ts +1724 -0
  81. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/http2.d.ts +2129 -0
  82. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/https.d.ts +441 -0
  83. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/index.d.ts +88 -0
  84. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/inspector.d.ts +2748 -0
  85. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/module.d.ts +116 -0
  86. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/net.d.ts +888 -0
  87. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/os.d.ts +477 -0
  88. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/path.d.ts +191 -0
  89. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/perf_hooks.d.ts +638 -0
  90. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/process.d.ts +1494 -0
  91. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
  92. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
  93. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/readline/promises.d.ts +145 -0
  94. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/readline.d.ts +526 -0
  95. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
  96. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
  97. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
  98. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/stream/web.d.ts +330 -0
  99. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/stream.d.ts +1392 -0
  100. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
  101. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/test.d.ts +1052 -0
  102. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
  103. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/timers.d.ts +215 -0
  104. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/tls.d.ts +1119 -0
  105. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
  106. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/tty.d.ts +208 -0
  107. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/url.d.ts +901 -0
  108. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/util.d.ts +2052 -0
  109. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/v8.d.ts +635 -0
  110. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/vm.d.ts +894 -0
  111. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/wasi.d.ts +152 -0
  112. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/worker_threads.d.ts +693 -0
  113. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
  114. package/node_modules/@types/cacheable-request/node_modules/@types/node/tty.d.ts +11 -7
  115. package/node_modules/@types/cacheable-request/node_modules/@types/node/url.d.ts +66 -56
  116. package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +528 -70
  117. package/node_modules/@types/cacheable-request/node_modules/@types/node/v8.d.ts +271 -14
  118. package/node_modules/@types/cacheable-request/node_modules/@types/node/vm.d.ts +421 -34
  119. package/node_modules/@types/cacheable-request/node_modules/@types/node/wasi.d.ts +15 -21
  120. package/node_modules/@types/cacheable-request/node_modules/@types/node/worker_threads.d.ts +81 -37
  121. package/node_modules/@types/cacheable-request/node_modules/@types/node/zlib.d.ts +11 -11
  122. package/node_modules/@types/cacheable-request/package.json +5 -5
  123. package/node_modules/@types/keyv/README.md +1 -1
  124. package/node_modules/@types/keyv/index.d.ts +16 -3
  125. package/node_modules/@types/keyv/node_modules/@types/node/README.md +2 -2
  126. package/node_modules/@types/keyv/node_modules/@types/node/assert.d.ts +135 -75
  127. package/node_modules/@types/keyv/node_modules/@types/node/async_hooks.d.ts +67 -38
  128. package/node_modules/@types/keyv/node_modules/@types/node/buffer.d.ts +226 -104
  129. package/node_modules/@types/keyv/node_modules/@types/node/child_process.d.ts +87 -58
  130. package/node_modules/@types/keyv/node_modules/@types/node/cluster.d.ts +29 -29
  131. package/node_modules/@types/keyv/node_modules/@types/node/console.d.ts +5 -5
  132. package/node_modules/@types/keyv/node_modules/@types/node/crypto.d.ts +888 -256
  133. package/node_modules/@types/keyv/node_modules/@types/node/dgram.d.ts +16 -16
  134. package/node_modules/@types/keyv/node_modules/@types/node/diagnostics_channel.d.ts +60 -21
  135. package/node_modules/@types/keyv/node_modules/@types/node/dns/promises.d.ts +52 -8
  136. package/node_modules/@types/keyv/node_modules/@types/node/dns.d.ts +27 -18
  137. package/node_modules/@types/keyv/node_modules/@types/node/dom-events.d.ts +126 -0
  138. package/node_modules/@types/keyv/node_modules/@types/node/domain.d.ts +6 -5
  139. package/node_modules/@types/keyv/node_modules/@types/node/events.d.ts +166 -93
  140. package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +169 -70
  141. package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +301 -126
  142. package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +22 -13
  143. package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +453 -125
  144. package/node_modules/@types/keyv/node_modules/@types/node/http2.d.ts +74 -46
  145. package/node_modules/@types/keyv/node_modules/@types/node/https.d.ts +103 -53
  146. package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +6 -2
  147. package/node_modules/@types/keyv/node_modules/@types/node/inspector.d.ts +20 -16
  148. package/node_modules/@types/keyv/node_modules/@types/node/module.d.ts +6 -4
  149. package/node_modules/@types/keyv/node_modules/@types/node/net.d.ts +114 -22
  150. package/node_modules/@types/keyv/node_modules/@types/node/os.d.ts +36 -14
  151. package/node_modules/@types/keyv/node_modules/@types/node/package.json +15 -3
  152. package/node_modules/@types/keyv/node_modules/@types/node/path.d.ts +37 -26
  153. package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +96 -15
  154. package/node_modules/@types/keyv/node_modules/@types/node/process.d.ts +95 -82
  155. package/node_modules/@types/keyv/node_modules/@types/node/punycode.d.ts +1 -1
  156. package/node_modules/@types/keyv/node_modules/@types/node/querystring.d.ts +6 -6
  157. package/node_modules/@types/keyv/node_modules/@types/node/readline/promises.d.ts +145 -0
  158. package/node_modules/@types/keyv/node_modules/@types/node/readline.d.ts +51 -175
  159. package/node_modules/@types/keyv/node_modules/@types/node/repl.d.ts +21 -21
  160. package/node_modules/@types/keyv/node_modules/@types/node/stream/consumers.d.ts +2 -14
  161. package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +983 -824
  162. package/node_modules/@types/keyv/node_modules/@types/node/string_decoder.d.ts +6 -6
  163. package/node_modules/@types/keyv/node_modules/@types/node/test.d.ts +1052 -0
  164. package/node_modules/@types/keyv/node_modules/@types/node/timers/promises.d.ts +26 -1
  165. package/node_modules/@types/keyv/node_modules/@types/node/timers.d.ts +127 -6
  166. package/node_modules/@types/keyv/node_modules/@types/node/tls.d.ts +149 -50
  167. package/node_modules/@types/keyv/node_modules/@types/node/trace_events.d.ts +30 -9
  168. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
  169. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/assert.d.ts +972 -0
  170. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/async_hooks.d.ts +530 -0
  171. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/buffer.d.ts +2354 -0
  172. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/child_process.d.ts +1395 -0
  173. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/cluster.d.ts +414 -0
  174. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/console.d.ts +412 -0
  175. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
  176. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/crypto.d.ts +3969 -0
  177. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
  178. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +191 -0
  179. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/dns/promises.d.ts +414 -0
  180. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/dns.d.ts +668 -0
  181. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/dom-events.d.ts +126 -0
  182. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
  183. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/events.d.ts +724 -0
  184. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/fs/promises.d.ts +1189 -0
  185. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/fs.d.ts +4044 -0
  186. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/globals.d.ts +303 -0
  187. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
  188. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/http.d.ts +1724 -0
  189. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/http2.d.ts +2129 -0
  190. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/https.d.ts +441 -0
  191. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/index.d.ts +88 -0
  192. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/inspector.d.ts +2748 -0
  193. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/module.d.ts +116 -0
  194. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/net.d.ts +888 -0
  195. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/os.d.ts +477 -0
  196. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/path.d.ts +191 -0
  197. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/perf_hooks.d.ts +638 -0
  198. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/process.d.ts +1494 -0
  199. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
  200. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
  201. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/readline/promises.d.ts +145 -0
  202. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/readline.d.ts +526 -0
  203. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
  204. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
  205. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
  206. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/stream/web.d.ts +330 -0
  207. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/stream.d.ts +1392 -0
  208. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
  209. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/test.d.ts +1052 -0
  210. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
  211. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/timers.d.ts +215 -0
  212. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/tls.d.ts +1119 -0
  213. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
  214. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/tty.d.ts +208 -0
  215. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/url.d.ts +901 -0
  216. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/util.d.ts +2052 -0
  217. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/v8.d.ts +635 -0
  218. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/vm.d.ts +894 -0
  219. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/wasi.d.ts +152 -0
  220. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/worker_threads.d.ts +693 -0
  221. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
  222. package/node_modules/@types/keyv/node_modules/@types/node/tty.d.ts +11 -7
  223. package/node_modules/@types/keyv/node_modules/@types/node/url.d.ts +66 -56
  224. package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +528 -70
  225. package/node_modules/@types/keyv/node_modules/@types/node/v8.d.ts +271 -14
  226. package/node_modules/@types/keyv/node_modules/@types/node/vm.d.ts +421 -34
  227. package/node_modules/@types/keyv/node_modules/@types/node/wasi.d.ts +15 -21
  228. package/node_modules/@types/keyv/node_modules/@types/node/worker_threads.d.ts +81 -37
  229. package/node_modules/@types/keyv/node_modules/@types/node/zlib.d.ts +11 -11
  230. package/node_modules/@types/keyv/package.json +3 -3
  231. package/node_modules/@types/responselike/node_modules/@types/node/README.md +2 -2
  232. package/node_modules/@types/responselike/node_modules/@types/node/assert.d.ts +135 -75
  233. package/node_modules/@types/responselike/node_modules/@types/node/async_hooks.d.ts +67 -38
  234. package/node_modules/@types/responselike/node_modules/@types/node/buffer.d.ts +226 -104
  235. package/node_modules/@types/responselike/node_modules/@types/node/child_process.d.ts +87 -58
  236. package/node_modules/@types/responselike/node_modules/@types/node/cluster.d.ts +29 -29
  237. package/node_modules/@types/responselike/node_modules/@types/node/console.d.ts +5 -5
  238. package/node_modules/@types/responselike/node_modules/@types/node/crypto.d.ts +888 -256
  239. package/node_modules/@types/responselike/node_modules/@types/node/dgram.d.ts +16 -16
  240. package/node_modules/@types/responselike/node_modules/@types/node/diagnostics_channel.d.ts +60 -21
  241. package/node_modules/@types/responselike/node_modules/@types/node/dns/promises.d.ts +52 -8
  242. package/node_modules/@types/responselike/node_modules/@types/node/dns.d.ts +27 -18
  243. package/node_modules/@types/responselike/node_modules/@types/node/dom-events.d.ts +126 -0
  244. package/node_modules/@types/responselike/node_modules/@types/node/domain.d.ts +6 -5
  245. package/node_modules/@types/responselike/node_modules/@types/node/events.d.ts +166 -93
  246. package/node_modules/@types/responselike/node_modules/@types/node/fs/promises.d.ts +169 -70
  247. package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +301 -126
  248. package/node_modules/@types/responselike/node_modules/@types/node/globals.d.ts +22 -13
  249. package/node_modules/@types/responselike/node_modules/@types/node/http.d.ts +453 -125
  250. package/node_modules/@types/responselike/node_modules/@types/node/http2.d.ts +74 -46
  251. package/node_modules/@types/responselike/node_modules/@types/node/https.d.ts +103 -53
  252. package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +6 -2
  253. package/node_modules/@types/responselike/node_modules/@types/node/inspector.d.ts +20 -16
  254. package/node_modules/@types/responselike/node_modules/@types/node/module.d.ts +6 -4
  255. package/node_modules/@types/responselike/node_modules/@types/node/net.d.ts +114 -22
  256. package/node_modules/@types/responselike/node_modules/@types/node/os.d.ts +36 -14
  257. package/node_modules/@types/responselike/node_modules/@types/node/package.json +15 -3
  258. package/node_modules/@types/responselike/node_modules/@types/node/path.d.ts +37 -26
  259. package/node_modules/@types/responselike/node_modules/@types/node/perf_hooks.d.ts +96 -15
  260. package/node_modules/@types/responselike/node_modules/@types/node/process.d.ts +95 -82
  261. package/node_modules/@types/responselike/node_modules/@types/node/punycode.d.ts +1 -1
  262. package/node_modules/@types/responselike/node_modules/@types/node/querystring.d.ts +6 -6
  263. package/node_modules/@types/responselike/node_modules/@types/node/readline/promises.d.ts +145 -0
  264. package/node_modules/@types/responselike/node_modules/@types/node/readline.d.ts +51 -175
  265. package/node_modules/@types/responselike/node_modules/@types/node/repl.d.ts +21 -21
  266. package/node_modules/@types/responselike/node_modules/@types/node/stream/consumers.d.ts +2 -14
  267. package/node_modules/@types/responselike/node_modules/@types/node/stream.d.ts +983 -824
  268. package/node_modules/@types/responselike/node_modules/@types/node/string_decoder.d.ts +6 -6
  269. package/node_modules/@types/responselike/node_modules/@types/node/test.d.ts +1052 -0
  270. package/node_modules/@types/responselike/node_modules/@types/node/timers/promises.d.ts +26 -1
  271. package/node_modules/@types/responselike/node_modules/@types/node/timers.d.ts +127 -6
  272. package/node_modules/@types/responselike/node_modules/@types/node/tls.d.ts +149 -50
  273. package/node_modules/@types/responselike/node_modules/@types/node/trace_events.d.ts +30 -9
  274. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
  275. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/assert.d.ts +972 -0
  276. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/async_hooks.d.ts +530 -0
  277. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/buffer.d.ts +2354 -0
  278. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/child_process.d.ts +1395 -0
  279. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/cluster.d.ts +414 -0
  280. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/console.d.ts +412 -0
  281. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
  282. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/crypto.d.ts +3969 -0
  283. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
  284. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +191 -0
  285. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/dns/promises.d.ts +414 -0
  286. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/dns.d.ts +668 -0
  287. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/dom-events.d.ts +126 -0
  288. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
  289. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/events.d.ts +724 -0
  290. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/fs/promises.d.ts +1189 -0
  291. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/fs.d.ts +4044 -0
  292. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/globals.d.ts +303 -0
  293. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
  294. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/http.d.ts +1724 -0
  295. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/http2.d.ts +2129 -0
  296. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/https.d.ts +441 -0
  297. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/index.d.ts +88 -0
  298. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/inspector.d.ts +2748 -0
  299. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/module.d.ts +116 -0
  300. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/net.d.ts +888 -0
  301. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/os.d.ts +477 -0
  302. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/path.d.ts +191 -0
  303. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/perf_hooks.d.ts +638 -0
  304. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/process.d.ts +1494 -0
  305. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
  306. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
  307. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/readline/promises.d.ts +145 -0
  308. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/readline.d.ts +526 -0
  309. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
  310. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
  311. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
  312. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/stream/web.d.ts +330 -0
  313. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/stream.d.ts +1392 -0
  314. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
  315. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/test.d.ts +1052 -0
  316. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
  317. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/timers.d.ts +215 -0
  318. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/tls.d.ts +1119 -0
  319. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
  320. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/tty.d.ts +208 -0
  321. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/url.d.ts +901 -0
  322. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/util.d.ts +2052 -0
  323. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/v8.d.ts +635 -0
  324. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/vm.d.ts +894 -0
  325. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/wasi.d.ts +152 -0
  326. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/worker_threads.d.ts +693 -0
  327. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
  328. package/node_modules/@types/responselike/node_modules/@types/node/tty.d.ts +11 -7
  329. package/node_modules/@types/responselike/node_modules/@types/node/url.d.ts +66 -56
  330. package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +528 -70
  331. package/node_modules/@types/responselike/node_modules/@types/node/v8.d.ts +271 -14
  332. package/node_modules/@types/responselike/node_modules/@types/node/vm.d.ts +421 -34
  333. package/node_modules/@types/responselike/node_modules/@types/node/wasi.d.ts +15 -21
  334. package/node_modules/@types/responselike/node_modules/@types/node/worker_threads.d.ts +81 -37
  335. package/node_modules/@types/responselike/node_modules/@types/node/zlib.d.ts +11 -11
  336. package/node_modules/cacheable-request/package.json +1 -1
  337. package/node_modules/clone-response/node_modules/mimic-response/index.js +32 -0
  338. package/node_modules/{get-stream → clone-response/node_modules/mimic-response}/license +1 -1
  339. package/node_modules/clone-response/node_modules/mimic-response/package.json +37 -0
  340. package/node_modules/clone-response/node_modules/mimic-response/readme.md +54 -0
  341. package/node_modules/clone-response/package.json +3 -6
  342. package/node_modules/got/dist/source/as-promise/index.js +1 -0
  343. package/node_modules/got/package.json +2 -1
  344. package/node_modules/http-cache-semantics/index.js +4 -3
  345. package/node_modules/http-cache-semantics/package.json +2 -8
  346. package/node_modules/keyv/README.md +141 -5
  347. package/node_modules/keyv/package.json +56 -50
  348. package/node_modules/keyv/src/index.d.ts +116 -0
  349. package/node_modules/keyv/src/index.js +179 -24
  350. package/node_modules/mimic-response/index.js +58 -13
  351. package/node_modules/mimic-response/license +1 -1
  352. package/node_modules/mimic-response/package.json +40 -35
  353. package/node_modules/mimic-response/readme.md +33 -9
  354. package/node_modules/responselike/package.json +3 -2
  355. package/package.json +54 -25
  356. package/rosetta/default.ts-fixture +17 -0
  357. package/changelog.md +0 -2
  358. package/node_modules/decompress-response/node_modules/mimic-response/index.js +0 -77
  359. package/node_modules/decompress-response/node_modules/mimic-response/package.json +0 -42
  360. package/node_modules/decompress-response/node_modules/mimic-response/readme.md +0 -78
  361. package/node_modules/keyv/.nyc_output/37411020-4142-4b08-b825-343ba2427bf7.json +0 -1
  362. package/node_modules/keyv/.nyc_output/cd79f2de-c8b8-4493-bc15-b2bde28efa4b.json +0 -1
  363. package/node_modules/keyv/.nyc_output/processinfo/37411020-4142-4b08-b825-343ba2427bf7.json +0 -1
  364. package/node_modules/keyv/.nyc_output/processinfo/cd79f2de-c8b8-4493-bc15-b2bde28efa4b.json +0 -1
  365. package/node_modules/keyv/.nyc_output/processinfo/index.json +0 -1
  366. package/node_modules/keyv/test/test.js +0 -132
  367. package/node_modules/keyv/test/testdb.sqlite +0 -0
  368. package/releasetag.txt +0 -1
  369. package/version.txt +0 -1
  370. /package/node_modules/{get-stream → cacheable-request/node_modules/get-stream}/buffer-stream.js +0 -0
  371. /package/node_modules/{get-stream → cacheable-request/node_modules/get-stream}/index.d.ts +0 -0
  372. /package/node_modules/{get-stream → cacheable-request/node_modules/get-stream}/index.js +0 -0
  373. /package/node_modules/{decompress-response/node_modules/mimic-response → cacheable-request/node_modules/get-stream}/license +0 -0
  374. /package/node_modules/{get-stream → cacheable-request/node_modules/get-stream}/package.json +0 -0
  375. /package/node_modules/{get-stream → cacheable-request/node_modules/get-stream}/readme.md +0 -0
  376. /package/node_modules/{decompress-response/node_modules/mimic-response → mimic-response}/index.d.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  /**
2
- * To use the HTTP server and client one must `require('http')`.
2
+ * To use the HTTP server and client one must `require('node:http')`.
3
3
  *
4
4
  * The HTTP interfaces in Node.js are designed to support many features
5
5
  * of the protocol which have been traditionally difficult to use.
@@ -13,7 +13,7 @@
13
13
  * { 'content-length': '123',
14
14
  * 'content-type': 'text/plain',
15
15
  * 'connection': 'keep-alive',
16
- * 'host': 'mysite.com',
16
+ * 'host': 'example.com',
17
17
  * 'accept': '*' }
18
18
  * ```
19
19
  *
@@ -34,14 +34,16 @@
34
34
  * 'content-LENGTH', '123',
35
35
  * 'content-type', 'text/plain',
36
36
  * 'CONNECTION', 'keep-alive',
37
- * 'Host', 'mysite.com',
37
+ * 'Host', 'example.com',
38
38
  * 'accepT', '*' ]
39
39
  * ```
40
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/http.js)
40
+ * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/http.js)
41
41
  */
42
42
  declare module 'http' {
43
43
  import * as stream from 'node:stream';
44
44
  import { URL } from 'node:url';
45
+ import { LookupOptions } from 'node:dns';
46
+ import { EventEmitter } from 'node:events';
45
47
  import { TcpSocketConnectOpts, Socket, Server as NetServer, LookupFunction } from 'node:net';
46
48
  // incoming headers will never contain number
47
49
  interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> {
@@ -113,56 +115,136 @@ declare module 'http' {
113
115
  type OutgoingHttpHeader = number | string | string[];
114
116
  interface OutgoingHttpHeaders extends NodeJS.Dict<OutgoingHttpHeader> {}
115
117
  interface ClientRequestArgs {
116
- signal?: AbortSignal | undefined;
117
- protocol?: string | null | undefined;
118
+ _defaultAgent?: Agent | undefined;
119
+ agent?: Agent | boolean | undefined;
120
+ auth?: string | null | undefined;
121
+ // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278
122
+ createConnection?:
123
+ | ((options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket)
124
+ | undefined;
125
+ defaultPort?: number | string | undefined;
126
+ family?: number | undefined;
127
+ headers?: OutgoingHttpHeaders | undefined;
128
+ hints?: LookupOptions['hints'];
118
129
  host?: string | null | undefined;
119
130
  hostname?: string | null | undefined;
120
- family?: number | undefined;
121
- port?: number | string | null | undefined;
122
- defaultPort?: number | string | undefined;
131
+ insecureHTTPParser?: boolean | undefined;
123
132
  localAddress?: string | undefined;
124
- socketPath?: string | undefined;
133
+ localPort?: number | undefined;
134
+ lookup?: LookupFunction | undefined;
125
135
  /**
126
- * @default 8192
136
+ * @default 16384
127
137
  */
128
138
  maxHeaderSize?: number | undefined;
129
139
  method?: string | undefined;
130
140
  path?: string | null | undefined;
131
- headers?: OutgoingHttpHeaders | undefined;
132
- auth?: string | null | undefined;
133
- agent?: Agent | boolean | undefined;
134
- _defaultAgent?: Agent | undefined;
135
- timeout?: number | undefined;
141
+ port?: number | string | null | undefined;
142
+ protocol?: string | null | undefined;
136
143
  setHost?: boolean | undefined;
137
- // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278
138
- createConnection?: ((options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket) | undefined;
139
- lookup?: LookupFunction | undefined;
144
+ signal?: AbortSignal | undefined;
145
+ socketPath?: string | undefined;
146
+ timeout?: number | undefined;
147
+ uniqueHeaders?: Array<string | string[]> | undefined;
148
+ joinDuplicateHeaders?: boolean;
140
149
  }
141
- interface ServerOptions {
142
- IncomingMessage?: typeof IncomingMessage | undefined;
143
- ServerResponse?: typeof ServerResponse | undefined;
150
+ interface ServerOptions<
151
+ Request extends typeof IncomingMessage = typeof IncomingMessage,
152
+ Response extends typeof ServerResponse = typeof ServerResponse,
153
+ > {
154
+ /**
155
+ * Specifies the `IncomingMessage` class to be used. Useful for extending the original `IncomingMessage`.
156
+ */
157
+ IncomingMessage?: Request | undefined;
158
+ /**
159
+ * Specifies the `ServerResponse` class to be used. Useful for extending the original `ServerResponse`.
160
+ */
161
+ ServerResponse?: Response | undefined;
162
+ /**
163
+ * Sets the timeout value in milliseconds for receiving the entire request from the client.
164
+ * @see Server.requestTimeout for more information.
165
+ * @default 300000
166
+ * @since v18.0.0
167
+ */
168
+ requestTimeout?: number | undefined;
169
+ /**
170
+ * It joins the field line values of multiple headers in a request with `, ` instead of discarding the duplicates.
171
+ * @default false
172
+ * @since v18.14.0
173
+ */
174
+ joinDuplicateHeaders?: boolean;
175
+ /**
176
+ * The number of milliseconds of inactivity a server needs to wait for additional incoming data,
177
+ * after it has finished writing the last response, before a socket will be destroyed.
178
+ * @see Server.keepAliveTimeout for more information.
179
+ * @default 5000
180
+ * @since v18.0.0
181
+ */
182
+ keepAliveTimeout?: number | undefined;
183
+ /**
184
+ * Sets the interval value in milliseconds to check for request and headers timeout in incomplete requests.
185
+ * @default 30000
186
+ */
187
+ connectionsCheckingInterval?: number | undefined;
188
+ /**
189
+ * Optionally overrides all `socket`s' `readableHighWaterMark` and `writableHighWaterMark`.
190
+ * This affects `highWaterMark` property of both `IncomingMessage` and `ServerResponse`.
191
+ * Default: @see stream.getDefaultHighWaterMark().
192
+ * @since v20.1.0
193
+ */
194
+ highWaterMark?: number | undefined;
195
+ /**
196
+ * Use an insecure HTTP parser that accepts invalid HTTP headers when `true`.
197
+ * Using the insecure parser should be avoided.
198
+ * See --insecure-http-parser for more information.
199
+ * @default false
200
+ */
201
+ insecureHTTPParser?: boolean | undefined;
144
202
  /**
145
203
  * Optionally overrides the value of
146
204
  * `--max-http-header-size` for requests received by this server, i.e.
147
205
  * the maximum length of request headers in bytes.
148
- * @default 8192
206
+ * @default 16384
207
+ * @since v13.3.0
149
208
  */
150
209
  maxHeaderSize?: number | undefined;
151
210
  /**
152
- * Use an insecure HTTP parser that accepts invalid HTTP headers when true.
153
- * Using the insecure parser should be avoided.
154
- * See --insecure-http-parser for more information.
211
+ * If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received.
212
+ * @default true
213
+ * @since v16.5.0
214
+ */
215
+ noDelay?: boolean | undefined;
216
+ /**
217
+ * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received,
218
+ * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`.
155
219
  * @default false
220
+ * @since v16.5.0
156
221
  */
157
- insecureHTTPParser?: boolean | undefined;
222
+ keepAlive?: boolean | undefined;
223
+ /**
224
+ * If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket.
225
+ * @default 0
226
+ * @since v16.5.0
227
+ */
228
+ keepAliveInitialDelay?: number | undefined;
229
+ /**
230
+ * A list of response headers that should be sent only once.
231
+ * If the header's value is an array, the items will be joined using `; `.
232
+ */
233
+ uniqueHeaders?: Array<string | string[]> | undefined;
158
234
  }
159
- type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
235
+ type RequestListener<
236
+ Request extends typeof IncomingMessage = typeof IncomingMessage,
237
+ Response extends typeof ServerResponse = typeof ServerResponse,
238
+ > = (req: InstanceType<Request>, res: InstanceType<Response> & { req: InstanceType<Request> }) => void;
160
239
  /**
161
240
  * @since v0.1.17
162
241
  */
163
- class Server extends NetServer {
164
- constructor(requestListener?: RequestListener);
165
- constructor(options: ServerOptions, requestListener?: RequestListener);
242
+ class Server<
243
+ Request extends typeof IncomingMessage = typeof IncomingMessage,
244
+ Response extends typeof ServerResponse = typeof ServerResponse,
245
+ > extends NetServer {
246
+ constructor(requestListener?: RequestListener<Request, Response>);
247
+ constructor(options: ServerOptions<Request, Response>, requestListener?: RequestListener<Request, Response>);
166
248
  /**
167
249
  * Sets the timeout value for sockets, and emits a `'timeout'` event on
168
250
  * the Server object, passing the socket as an argument, if a timeout
@@ -211,14 +293,12 @@ declare module 'http' {
211
293
  * Limit the amount of time the parser will wait to receive the complete HTTP
212
294
  * headers.
213
295
  *
214
- * In case of inactivity, the rules defined in `server.timeout` apply. However,
215
- * that inactivity based timeout would still allow the connection to be kept open
216
- * if the headers are being sent very slowly (by default, up to a byte per 2
217
- * minutes). In order to prevent this, whenever header data arrives an additional
218
- * check is made that more than `server.headersTimeout` milliseconds has not
219
- * passed since the connection was established. If the check fails, a `'timeout'`event is emitted on the server object, and (by default) the socket is destroyed.
220
- * See `server.timeout` for more information on how timeout behavior can be
221
- * customized.
296
+ * If the timeout expires, the server responds with status 408 without
297
+ * forwarding the request to the request listener and then closes the connection.
298
+ *
299
+ * It must be set to a non-zero value (e.g. 120 seconds) to protect against
300
+ * potential Denial-of-Service attacks in case the server is deployed without a
301
+ * reverse proxy in front.
222
302
  * @since v11.3.0, v10.14.0
223
303
  */
224
304
  headersTimeout: number;
@@ -251,80 +331,109 @@ declare module 'http' {
251
331
  * @since v14.11.0
252
332
  */
253
333
  requestTimeout: number;
334
+ /**
335
+ * Closes all connections connected to this server.
336
+ * @since v18.2.0
337
+ */
338
+ closeAllConnections(): void;
339
+ /**
340
+ * Closes all connections connected to this server which are not sending a request
341
+ * or waiting for a response.
342
+ * @since v18.2.0
343
+ */
344
+ closeIdleConnections(): void;
254
345
  addListener(event: string, listener: (...args: any[]) => void): this;
255
346
  addListener(event: 'close', listener: () => void): this;
256
347
  addListener(event: 'connection', listener: (socket: Socket) => void): this;
257
348
  addListener(event: 'error', listener: (err: Error) => void): this;
258
349
  addListener(event: 'listening', listener: () => void): this;
259
- addListener(event: 'checkContinue', listener: RequestListener): this;
260
- addListener(event: 'checkExpectation', listener: RequestListener): this;
350
+ addListener(event: 'checkContinue', listener: RequestListener<Request, Response>): this;
351
+ addListener(event: 'checkExpectation', listener: RequestListener<Request, Response>): this;
261
352
  addListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
262
- addListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
263
- addListener(event: 'request', listener: RequestListener): this;
264
- addListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
353
+ addListener(event: 'connect', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
354
+ addListener(event: 'dropRequest', listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
355
+ addListener(event: 'request', listener: RequestListener<Request, Response>): this;
356
+ addListener(event: 'upgrade', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
265
357
  emit(event: string, ...args: any[]): boolean;
266
358
  emit(event: 'close'): boolean;
267
359
  emit(event: 'connection', socket: Socket): boolean;
268
360
  emit(event: 'error', err: Error): boolean;
269
361
  emit(event: 'listening'): boolean;
270
- emit(event: 'checkContinue', req: IncomingMessage, res: ServerResponse): boolean;
271
- emit(event: 'checkExpectation', req: IncomingMessage, res: ServerResponse): boolean;
362
+ emit(
363
+ event: 'checkContinue',
364
+ req: InstanceType<Request>,
365
+ res: InstanceType<Response> & { req: InstanceType<Request> },
366
+ ): boolean;
367
+ emit(
368
+ event: 'checkExpectation',
369
+ req: InstanceType<Request>,
370
+ res: InstanceType<Response> & { req: InstanceType<Request> },
371
+ ): boolean;
272
372
  emit(event: 'clientError', err: Error, socket: stream.Duplex): boolean;
273
- emit(event: 'connect', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean;
274
- emit(event: 'request', req: IncomingMessage, res: ServerResponse): boolean;
275
- emit(event: 'upgrade', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean;
373
+ emit(event: 'connect', req: InstanceType<Request>, socket: stream.Duplex, head: Buffer): boolean;
374
+ emit(event: 'dropRequest', req: InstanceType<Request>, socket: stream.Duplex): boolean;
375
+ emit(
376
+ event: 'request',
377
+ req: InstanceType<Request>,
378
+ res: InstanceType<Response> & { req: InstanceType<Request> },
379
+ ): boolean;
380
+ emit(event: 'upgrade', req: InstanceType<Request>, socket: stream.Duplex, head: Buffer): boolean;
276
381
  on(event: string, listener: (...args: any[]) => void): this;
277
382
  on(event: 'close', listener: () => void): this;
278
383
  on(event: 'connection', listener: (socket: Socket) => void): this;
279
384
  on(event: 'error', listener: (err: Error) => void): this;
280
385
  on(event: 'listening', listener: () => void): this;
281
- on(event: 'checkContinue', listener: RequestListener): this;
282
- on(event: 'checkExpectation', listener: RequestListener): this;
386
+ on(event: 'checkContinue', listener: RequestListener<Request, Response>): this;
387
+ on(event: 'checkExpectation', listener: RequestListener<Request, Response>): this;
283
388
  on(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
284
- on(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
285
- on(event: 'request', listener: RequestListener): this;
286
- on(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
389
+ on(event: 'connect', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
390
+ on(event: 'dropRequest', listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
391
+ on(event: 'request', listener: RequestListener<Request, Response>): this;
392
+ on(event: 'upgrade', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
287
393
  once(event: string, listener: (...args: any[]) => void): this;
288
394
  once(event: 'close', listener: () => void): this;
289
395
  once(event: 'connection', listener: (socket: Socket) => void): this;
290
396
  once(event: 'error', listener: (err: Error) => void): this;
291
397
  once(event: 'listening', listener: () => void): this;
292
- once(event: 'checkContinue', listener: RequestListener): this;
293
- once(event: 'checkExpectation', listener: RequestListener): this;
398
+ once(event: 'checkContinue', listener: RequestListener<Request, Response>): this;
399
+ once(event: 'checkExpectation', listener: RequestListener<Request, Response>): this;
294
400
  once(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
295
- once(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
296
- once(event: 'request', listener: RequestListener): this;
297
- once(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
401
+ once(event: 'connect', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
402
+ once(event: 'dropRequest', listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
403
+ once(event: 'request', listener: RequestListener<Request, Response>): this;
404
+ once(event: 'upgrade', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
298
405
  prependListener(event: string, listener: (...args: any[]) => void): this;
299
406
  prependListener(event: 'close', listener: () => void): this;
300
407
  prependListener(event: 'connection', listener: (socket: Socket) => void): this;
301
408
  prependListener(event: 'error', listener: (err: Error) => void): this;
302
409
  prependListener(event: 'listening', listener: () => void): this;
303
- prependListener(event: 'checkContinue', listener: RequestListener): this;
304
- prependListener(event: 'checkExpectation', listener: RequestListener): this;
410
+ prependListener(event: 'checkContinue', listener: RequestListener<Request, Response>): this;
411
+ prependListener(event: 'checkExpectation', listener: RequestListener<Request, Response>): this;
305
412
  prependListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
306
- prependListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
307
- prependListener(event: 'request', listener: RequestListener): this;
308
- prependListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
413
+ prependListener(event: 'connect', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
414
+ prependListener(event: 'dropRequest', listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
415
+ prependListener(event: 'request', listener: RequestListener<Request, Response>): this;
416
+ prependListener(event: 'upgrade', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
309
417
  prependOnceListener(event: string, listener: (...args: any[]) => void): this;
310
418
  prependOnceListener(event: 'close', listener: () => void): this;
311
419
  prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this;
312
420
  prependOnceListener(event: 'error', listener: (err: Error) => void): this;
313
421
  prependOnceListener(event: 'listening', listener: () => void): this;
314
- prependOnceListener(event: 'checkContinue', listener: RequestListener): this;
315
- prependOnceListener(event: 'checkExpectation', listener: RequestListener): this;
422
+ prependOnceListener(event: 'checkContinue', listener: RequestListener<Request, Response>): this;
423
+ prependOnceListener(event: 'checkExpectation', listener: RequestListener<Request, Response>): this;
316
424
  prependOnceListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
317
- prependOnceListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
318
- prependOnceListener(event: 'request', listener: RequestListener): this;
319
- prependOnceListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
425
+ prependOnceListener(event: 'connect', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
426
+ prependOnceListener(event: 'dropRequest', listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
427
+ prependOnceListener(event: 'request', listener: RequestListener<Request, Response>): this;
428
+ prependOnceListener(event: 'upgrade', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
320
429
  }
321
430
  /**
322
- * This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract of outgoing message from
323
- * the perspective of the participants of HTTP transaction.
431
+ * This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract outgoing message from
432
+ * the perspective of the participants of an HTTP transaction.
324
433
  * @since v0.1.17
325
434
  */
326
- class OutgoingMessage extends stream.Writable {
327
- readonly req: IncomingMessage;
435
+ class OutgoingMessage<Request extends IncomingMessage = IncomingMessage> extends stream.Writable {
436
+ readonly req: Request;
328
437
  chunkedEncoding: boolean;
329
438
  shouldKeepAlive: boolean;
330
439
  useChunkedEncodingByDefault: boolean;
@@ -339,7 +448,7 @@ declare module 'http' {
339
448
  */
340
449
  readonly headersSent: boolean;
341
450
  /**
342
- * Aliases of `outgoingMessage.socket`
451
+ * Alias of `outgoingMessage.socket`.
343
452
  * @since v0.3.0
344
453
  * @deprecated Since v15.12.0,v14.17.1 - Use `socket` instead.
345
454
  */
@@ -360,15 +469,33 @@ declare module 'http' {
360
469
  */
361
470
  setTimeout(msecs: number, callback?: () => void): this;
362
471
  /**
363
- * Sets a single header value for the header object.
472
+ * Sets a single header value. If the header already exists in the to-be-sent
473
+ * headers, its value will be replaced. Use an array of strings to send multiple
474
+ * headers with the same name.
364
475
  * @since v0.4.0
365
476
  * @param name Header name
366
477
  * @param value Header value
367
478
  */
368
479
  setHeader(name: string, value: number | string | ReadonlyArray<string>): this;
369
480
  /**
370
- * Gets the value of HTTP header with the given name. If such a name doesn't
371
- * exist in message, it will be `undefined`.
481
+ * Append a single header value for the header object.
482
+ *
483
+ * If the value is an array, this is equivalent of calling this method multiple
484
+ * times.
485
+ *
486
+ * If there were no previous value for the header, this is equivalent of calling `outgoingMessage.setHeader(name, value)`.
487
+ *
488
+ * Depending of the value of `options.uniqueHeaders` when the client request or the
489
+ * server were created, this will end up in the header being sent multiple times or
490
+ * a single time with values joined using `; `.
491
+ * @since v18.3.0, v16.17.0
492
+ * @param name Header name
493
+ * @param value Header value
494
+ */
495
+ appendHeader(name: string, value: string | ReadonlyArray<string>): this;
496
+ /**
497
+ * Gets the value of the HTTP header with the given name. If that header is not
498
+ * set, the returned value will be `undefined`.
372
499
  * @since v0.4.0
373
500
  * @param name Name of header
374
501
  */
@@ -381,8 +508,8 @@ declare module 'http' {
381
508
  * values. All header names are lowercase.
382
509
  *
383
510
  * The object returned by the `outgoingMessage.getHeaders()` method does
384
- * not prototypically inherit from the JavaScript Object. This means that
385
- * typical Object methods such as `obj.toString()`, `obj.hasOwnProperty()`,
511
+ * not prototypically inherit from the JavaScript `Object`. This means that
512
+ * typical `Object` methods such as `obj.toString()`, `obj.hasOwnProperty()`,
386
513
  * and others are not defined and will not work.
387
514
  *
388
515
  * ```js
@@ -392,13 +519,13 @@ declare module 'http' {
392
519
  * const headers = outgoingMessage.getHeaders();
393
520
  * // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] }
394
521
  * ```
395
- * @since v8.0.0
522
+ * @since v7.7.0
396
523
  */
397
524
  getHeaders(): OutgoingHttpHeaders;
398
525
  /**
399
- * Returns an array of names of headers of the outgoing outgoingMessage. All
400
- * names are lowercase.
401
- * @since v8.0.0
526
+ * Returns an array containing the unique names of the current outgoing headers.
527
+ * All names are lowercase.
528
+ * @since v7.7.0
402
529
  */
403
530
  getHeaderNames(): string[];
404
531
  /**
@@ -408,7 +535,7 @@ declare module 'http' {
408
535
  * ```js
409
536
  * const hasContentType = outgoingMessage.hasHeader('content-type');
410
537
  * ```
411
- * @since v8.0.0
538
+ * @since v7.7.0
412
539
  */
413
540
  hasHeader(name: string): boolean;
414
541
  /**
@@ -418,16 +545,17 @@ declare module 'http' {
418
545
  * outgoingMessage.removeHeader('Content-Encoding');
419
546
  * ```
420
547
  * @since v0.4.0
548
+ * @param name Header name
421
549
  */
422
550
  removeHeader(name: string): void;
423
551
  /**
424
552
  * Adds HTTP trailers (headers but at the end of the message) to the message.
425
553
  *
426
- * Trailers are **only** be emitted if the message is chunked encoded. If not,
427
- * the trailer will be silently discarded.
554
+ * Trailers will **only** be emitted if the message is chunked encoded. If not,
555
+ * the trailers will be silently discarded.
428
556
  *
429
557
  * HTTP requires the `Trailer` header to be sent to emit trailers,
430
- * with a list of header fields in its value, e.g.
558
+ * with a list of header field names in its value, e.g.
431
559
  *
432
560
  * ```js
433
561
  * message.writeHead(200, { 'Content-Type': 'text/plain',
@@ -443,7 +571,7 @@ declare module 'http' {
443
571
  */
444
572
  addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void;
445
573
  /**
446
- * Compulsorily flushes the message headers
574
+ * Flushes the message headers.
447
575
  *
448
576
  * For efficiency reason, Node.js normally buffers the message headers
449
577
  * until `outgoingMessage.end()` is called or the first chunk of message data
@@ -451,7 +579,7 @@ declare module 'http' {
451
579
  * packet.
452
580
  *
453
581
  * It is usually desired (it saves a TCP round-trip), but not when the first
454
- * data is not sent until possibly much later. `outgoingMessage.flushHeaders()`bypasses the optimization and kickstarts the request.
582
+ * data is not sent until possibly much later. `outgoingMessage.flushHeaders()`bypasses the optimization and kickstarts the message.
455
583
  * @since v1.6.0
456
584
  */
457
585
  flushHeaders(): void;
@@ -461,7 +589,7 @@ declare module 'http' {
461
589
  * passed as the second parameter to the `'request'` event.
462
590
  * @since v0.1.17
463
591
  */
464
- class ServerResponse extends OutgoingMessage {
592
+ class ServerResponse<Request extends IncomingMessage = IncomingMessage> extends OutgoingMessage<Request> {
465
593
  /**
466
594
  * When using implicit headers (not calling `response.writeHead()` explicitly),
467
595
  * this property controls the status code that will be sent to the client when
@@ -491,15 +619,56 @@ declare module 'http' {
491
619
  * @since v0.11.8
492
620
  */
493
621
  statusMessage: string;
494
- constructor(req: IncomingMessage);
622
+ /**
623
+ * If set to `true`, Node.js will check whether the `Content-Length`header value and the size of the body, in bytes, are equal.
624
+ * Mismatching the `Content-Length` header value will result
625
+ * in an `Error` being thrown, identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`.
626
+ * @since v18.10.0, v16.18.0
627
+ */
628
+ strictContentLength: boolean;
629
+ constructor(req: Request);
495
630
  assignSocket(socket: Socket): void;
496
631
  detachSocket(socket: Socket): void;
497
632
  /**
498
- * Sends a HTTP/1.1 100 Continue message to the client, indicating that
633
+ * Sends an HTTP/1.1 100 Continue message to the client, indicating that
499
634
  * the request body should be sent. See the `'checkContinue'` event on`Server`.
500
635
  * @since v0.3.0
501
636
  */
502
637
  writeContinue(callback?: () => void): void;
638
+ /**
639
+ * Sends an HTTP/1.1 103 Early Hints message to the client with a Link header,
640
+ * indicating that the user agent can preload/preconnect the linked resources.
641
+ * The `hints` is an object containing the values of headers to be sent with
642
+ * early hints message. The optional `callback` argument will be called when
643
+ * the response message has been written.
644
+ *
645
+ * **Example**
646
+ *
647
+ * ```js
648
+ * const earlyHintsLink = '</styles.css>; rel=preload; as=style';
649
+ * response.writeEarlyHints({
650
+ * 'link': earlyHintsLink,
651
+ * });
652
+ *
653
+ * const earlyHintsLinks = [
654
+ * '</styles.css>; rel=preload; as=style',
655
+ * '</scripts.js>; rel=preload; as=script',
656
+ * ];
657
+ * response.writeEarlyHints({
658
+ * 'link': earlyHintsLinks,
659
+ * 'x-trace-id': 'id for diagnostics',
660
+ * });
661
+ *
662
+ * const earlyHintsCallback = () => console.log('early hints message sent');
663
+ * response.writeEarlyHints({
664
+ * 'link': earlyHintsLinks,
665
+ * }, earlyHintsCallback);
666
+ * ```
667
+ * @since v18.11.0
668
+ * @param hints An object containing the values of headers
669
+ * @param callback Will be called when the response message has been written
670
+ */
671
+ writeEarlyHints(hints: Record<string, string | string[]>, callback?: () => void): void;
503
672
  /**
504
673
  * Sends a response header to the request. The status code is a 3-digit HTTP
505
674
  * status code, like `404`. The last argument, `headers`, are the response headers.
@@ -518,7 +687,7 @@ declare module 'http' {
518
687
  * response
519
688
  * .writeHead(200, {
520
689
  * 'Content-Length': Buffer.byteLength(body),
521
- * 'Content-Type': 'text/plain'
690
+ * 'Content-Type': 'text/plain',
522
691
  * })
523
692
  * .end(body);
524
693
  * ```
@@ -549,15 +718,19 @@ declare module 'http' {
549
718
  * });
550
719
  * ```
551
720
  *
552
- * `Content-Length` is given in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. Node.js
553
- * does not check whether `Content-Length` and the length of the body which has
721
+ * `Content-Length` is read in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. Node.js
722
+ * will check whether `Content-Length` and the length of the body which has
554
723
  * been transmitted are equal or not.
555
724
  *
556
725
  * Attempting to set a header field name or value that contains invalid characters
557
- * will result in a `TypeError` being thrown.
726
+ * will result in a \[`Error`\]\[\] being thrown.
558
727
  * @since v0.1.30
559
728
  */
560
- writeHead(statusCode: number, statusMessage?: string, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
729
+ writeHead(
730
+ statusCode: number,
731
+ statusMessage?: string,
732
+ headers?: OutgoingHttpHeaders | OutgoingHttpHeader[],
733
+ ): this;
561
734
  writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
562
735
  /**
563
736
  * Sends a HTTP/1.1 102 Processing message to the client, indicating that
@@ -599,8 +772,11 @@ declare module 'http' {
599
772
  *
600
773
  * For backward compatibility, `res` will only emit `'error'` if there is an`'error'` listener registered.
601
774
  *
602
- * Node.js does not check whether Content-Length and the length of the
603
- * body which has been transmitted are equal or not.
775
+ * Set `Content-Length` header to limit the response body size.
776
+ * If `response.strictContentLength` is set to `true`, mismatching the`Content-Length` header value will result in an `Error` being thrown,
777
+ * identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`.
778
+ *
779
+ * `Content-Length` value should be in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes.
604
780
  * @since v0.1.17
605
781
  */
606
782
  class ClientRequest extends OutgoingMessage {
@@ -608,7 +784,7 @@ declare module 'http' {
608
784
  * The `request.aborted` property will be `true` if the request has
609
785
  * been aborted.
610
786
  * @since v0.11.14
611
- * @deprecated Since v17.0.0 - Check `destroyed` instead.
787
+ * @deprecated Since v17.0.0,v16.12.0 - Check `destroyed` instead.
612
788
  */
613
789
  aborted: boolean;
614
790
  /**
@@ -622,13 +798,58 @@ declare module 'http' {
622
798
  */
623
799
  protocol: string;
624
800
  /**
625
- * Whether the request is send through a reused socket.
801
+ * When sending request through a keep-alive enabled agent, the underlying socket
802
+ * might be reused. But if server closes connection at unfortunate time, client
803
+ * may run into a 'ECONNRESET' error.
804
+ *
805
+ * ```js
806
+ * const http = require('node:http');
807
+ *
808
+ * // Server has a 5 seconds keep-alive timeout by default
809
+ * http
810
+ * .createServer((req, res) => {
811
+ * res.write('hello\n');
812
+ * res.end();
813
+ * })
814
+ * .listen(3000);
815
+ *
816
+ * setInterval(() => {
817
+ * // Adapting a keep-alive agent
818
+ * http.get('http://localhost:3000', { agent }, (res) => {
819
+ * res.on('data', (data) => {
820
+ * // Do nothing
821
+ * });
822
+ * });
823
+ * }, 5000); // Sending request on 5s interval so it's easy to hit idle timeout
824
+ * ```
825
+ *
826
+ * By marking a request whether it reused socket or not, we can do
827
+ * automatic error retry base on it.
828
+ *
829
+ * ```js
830
+ * const http = require('node:http');
831
+ * const agent = new http.Agent({ keepAlive: true });
832
+ *
833
+ * function retriableRequest() {
834
+ * const req = http
835
+ * .get('http://localhost:3000', { agent }, (res) => {
836
+ * // ...
837
+ * })
838
+ * .on('error', (err) => {
839
+ * // Check if retry is needed
840
+ * if (req.reusedSocket &#x26;&#x26; err.code === 'ECONNRESET') {
841
+ * retriableRequest();
842
+ * }
843
+ * });
844
+ * }
845
+ *
846
+ * retriableRequest();
847
+ * ```
626
848
  * @since v13.0.0, v12.16.0
627
849
  */
628
850
  reusedSocket: boolean;
629
851
  /**
630
852
  * Limits maximum response headers count. If set to 0, no limit will be applied.
631
- * @default 2000
632
853
  */
633
854
  maxHeadersCount: number;
634
855
  constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void);
@@ -775,7 +996,7 @@ declare module 'http' {
775
996
  /**
776
997
  * 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
777
998
  * access response
778
- * status, headers and data.
999
+ * status, headers, and data.
779
1000
  *
780
1001
  * Different from its `socket` value which is a subclass of `stream.Duplex`, the`IncomingMessage` itself extends `stream.Readable` and is created separately to
781
1002
  * parse and emit the incoming HTTP headers and payload, as the underlying socket
@@ -788,7 +1009,7 @@ declare module 'http' {
788
1009
  * The `message.aborted` property will be `true` if the request has
789
1010
  * been aborted.
790
1011
  * @since v10.1.0
791
- * @deprecated Since v17.0.0 - Check `message.destroyed` from [stream.Readable](https://nodejs.org/dist/latest-v17.x/docs/api/stream.html#class-streamreadable).
1012
+ * @deprecated Since v17.0.0,v16.12.0 - Check `message.destroyed` from <a href="stream.html#class-streamreadable" class="type">stream.Readable</a>.
792
1013
  */
793
1014
  aborted: boolean;
794
1015
  /**
@@ -813,7 +1034,7 @@ declare module 'http' {
813
1034
  * const req = http.request({
814
1035
  * host: '127.0.0.1',
815
1036
  * port: 8080,
816
- * method: 'POST'
1037
+ * method: 'POST',
817
1038
  * }, (res) => {
818
1039
  * res.resume();
819
1040
  * res.on('end', () => {
@@ -840,7 +1061,7 @@ declare module 'http' {
840
1061
  *
841
1062
  * This property is guaranteed to be an instance of the `net.Socket` class,
842
1063
  * a subclass of `stream.Duplex`, unless the user specified a socket
843
- * type other than `net.Socket`.
1064
+ * type other than `net.Socket` or internally nulled.
844
1065
  * @since v0.3.0
845
1066
  */
846
1067
  socket: Socket;
@@ -863,12 +1084,30 @@ declare module 'http' {
863
1084
  *
864
1085
  * * Duplicates of `age`, `authorization`, `content-length`, `content-type`,`etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`,`last-modified`, `location`,
865
1086
  * `max-forwards`, `proxy-authorization`, `referer`,`retry-after`, `server`, or `user-agent` are discarded.
1087
+ * To allow duplicate values of the headers listed above to be joined,
1088
+ * use the option `joinDuplicateHeaders` in {@link request} and {@link createServer}. See RFC 9110 Section 5.3 for more
1089
+ * information.
866
1090
  * * `set-cookie` is always an array. Duplicates are added to the array.
867
- * * For duplicate `cookie` headers, the values are joined together with '; '.
868
- * * For all other headers, the values are joined together with ', '.
1091
+ * * For duplicate `cookie` headers, the values are joined together with `; `.
1092
+ * * For all other headers, the values are joined together with `, `.
869
1093
  * @since v0.1.5
870
1094
  */
871
1095
  headers: IncomingHttpHeaders;
1096
+ /**
1097
+ * Similar to `message.headers`, but there is no join logic and the values are
1098
+ * always arrays of strings, even for headers received just once.
1099
+ *
1100
+ * ```js
1101
+ * // Prints something like:
1102
+ * //
1103
+ * // { 'user-agent': ['curl/7.22.0'],
1104
+ * // host: ['127.0.0.1:8000'],
1105
+ * // accept: ['*'] }
1106
+ * console.log(request.headersDistinct);
1107
+ * ```
1108
+ * @since v18.3.0, v16.17.0
1109
+ */
1110
+ headersDistinct: NodeJS.Dict<string[]>;
872
1111
  /**
873
1112
  * The raw request/response headers list exactly as they were received.
874
1113
  *
@@ -899,6 +1138,13 @@ declare module 'http' {
899
1138
  * @since v0.3.0
900
1139
  */
901
1140
  trailers: NodeJS.Dict<string>;
1141
+ /**
1142
+ * Similar to `message.trailers`, but there is no join logic and the values are
1143
+ * always arrays of strings, even for headers received just once.
1144
+ * Only populated at the `'end'` event.
1145
+ * @since v18.3.0, v16.17.0
1146
+ */
1147
+ trailersDistinct: NodeJS.Dict<string[]>;
902
1148
  /**
903
1149
  * The raw request/response trailer keys and values exactly as they were
904
1150
  * received. Only populated at the `'end'` event.
@@ -934,7 +1180,7 @@ declare module 'http' {
934
1180
  * new URL(request.url, `http://${request.headers.host}`);
935
1181
  * ```
936
1182
  *
937
- * When `request.url` is `'/status?name=ryan'` and`request.headers.host` is `'localhost:3000'`:
1183
+ * When `request.url` is `'/status?name=ryan'` and `request.headers.host` is`'localhost:3000'`:
938
1184
  *
939
1185
  * ```console
940
1186
  * $ node
@@ -1058,16 +1304,16 @@ declare module 'http' {
1058
1304
  * hostname: 'localhost',
1059
1305
  * port: 80,
1060
1306
  * path: '/',
1061
- * agent: false // Create a new agent just for this one request
1307
+ * agent: false, // Create a new agent just for this one request
1062
1308
  * }, (res) => {
1063
1309
  * // Do stuff with response
1064
1310
  * });
1065
1311
  * ```
1066
1312
  * @since v0.3.4
1067
1313
  */
1068
- class Agent {
1314
+ class Agent extends EventEmitter {
1069
1315
  /**
1070
- * By default set to 256\. For agents with `keepAlive` enabled, this
1316
+ * By default set to 256. For agents with `keepAlive` enabled, this
1071
1317
  * sets the maximum number of sockets that will be left open in the free
1072
1318
  * state.
1073
1319
  * @since v0.11.7
@@ -1131,12 +1377,23 @@ declare module 'http' {
1131
1377
  * added to the `'request'` event.
1132
1378
  * @since v0.1.13
1133
1379
  */
1134
- function createServer(requestListener?: RequestListener): Server;
1135
- function createServer(options: ServerOptions, requestListener?: RequestListener): Server;
1380
+ function createServer<
1381
+ Request extends typeof IncomingMessage = typeof IncomingMessage,
1382
+ Response extends typeof ServerResponse = typeof ServerResponse,
1383
+ >(requestListener?: RequestListener<Request, Response>): Server<Request, Response>;
1384
+ function createServer<
1385
+ Request extends typeof IncomingMessage = typeof IncomingMessage,
1386
+ Response extends typeof ServerResponse = typeof ServerResponse,
1387
+ >(
1388
+ options: ServerOptions<Request, Response>,
1389
+ requestListener?: RequestListener<Request, Response>,
1390
+ ): Server<Request, Response>;
1136
1391
  // although RequestOptions are passed as ClientRequestArgs to ClientRequest directly,
1137
1392
  // create interface RequestOptions would make the naming more clear to developers
1138
1393
  interface RequestOptions extends ClientRequestArgs {}
1139
1394
  /**
1395
+ * `options` in `socket.connect()` are also supported.
1396
+ *
1140
1397
  * Node.js maintains several connections per server to make HTTP requests.
1141
1398
  * This function allows one to transparently issue requests.
1142
1399
  *
@@ -1152,10 +1409,10 @@ declare module 'http' {
1152
1409
  * upload a file with a POST request, then write to the `ClientRequest` object.
1153
1410
  *
1154
1411
  * ```js
1155
- * const http = require('http');
1412
+ * const http = require('node:http');
1156
1413
  *
1157
1414
  * const postData = JSON.stringify({
1158
- * 'msg': 'Hello World!'
1415
+ * 'msg': 'Hello World!',
1159
1416
  * });
1160
1417
  *
1161
1418
  * const options = {
@@ -1165,8 +1422,8 @@ declare module 'http' {
1165
1422
  * method: 'POST',
1166
1423
  * headers: {
1167
1424
  * 'Content-Type': 'application/json',
1168
- * 'Content-Length': Buffer.byteLength(postData)
1169
- * }
1425
+ * 'Content-Length': Buffer.byteLength(postData),
1426
+ * },
1170
1427
  * };
1171
1428
  *
1172
1429
  * const req = http.request(options, (res) => {
@@ -1253,7 +1510,7 @@ declare module 'http' {
1253
1510
  * * `'data'` any number of times, on the `res` object
1254
1511
  * * (connection closed here)
1255
1512
  * * `'aborted'` on the `res` object
1256
- * * `'error'` on the `res` object with an error with message`'Error: aborted'` and code `'ECONNRESET'`.
1513
+ * * `'error'` on the `res` object with an error with message`'Error: aborted'` and code `'ECONNRESET'`
1257
1514
  * * `'close'`
1258
1515
  * * `'close'` on the `res` object
1259
1516
  *
@@ -1261,7 +1518,7 @@ declare module 'http' {
1261
1518
  * events will be emitted in the following order:
1262
1519
  *
1263
1520
  * * (`req.destroy()` called here)
1264
- * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`
1521
+ * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`, or the error with which `req.destroy()` was called
1265
1522
  * * `'close'`
1266
1523
  *
1267
1524
  * If `req.destroy()` is called before the connection succeeds, the following
@@ -1269,7 +1526,7 @@ declare module 'http' {
1269
1526
  *
1270
1527
  * * `'socket'`
1271
1528
  * * (`req.destroy()` called here)
1272
- * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`
1529
+ * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`, or the error with which `req.destroy()` was called
1273
1530
  * * `'close'`
1274
1531
  *
1275
1532
  * If `req.destroy()` is called after the response is received, the following
@@ -1280,7 +1537,7 @@ declare module 'http' {
1280
1537
  * * `'data'` any number of times, on the `res` object
1281
1538
  * * (`req.destroy()` called here)
1282
1539
  * * `'aborted'` on the `res` object
1283
- * * `'error'` on the `res` object with an error with message`'Error: aborted'` and code `'ECONNRESET'`.
1540
+ * * `'error'` on the `res` object with an error with message `'Error: aborted'`and code `'ECONNRESET'`, or the error with which `req.destroy()` was called
1284
1541
  * * `'close'`
1285
1542
  * * `'close'` on the `res` object
1286
1543
  *
@@ -1316,8 +1573,9 @@ declare module 'http' {
1316
1573
  * Setting the `timeout` option or using the `setTimeout()` function will
1317
1574
  * not abort the request or do anything besides add a `'timeout'` event.
1318
1575
  *
1319
- * Passing an `AbortSignal` and then calling `abort` on the corresponding`AbortController` will behave the same way as calling `.destroy()` on the
1320
- * request itself.
1576
+ * Passing an `AbortSignal` and then calling `abort()` on the corresponding`AbortController` will behave the same way as calling `.destroy()` on the
1577
+ * request. Specifically, the `'error'` event will be emitted with an error with
1578
+ * the message `'AbortError: The operation was aborted'`, the code `'ABORT_ERR'`and the `cause`, if one was provided.
1321
1579
  * @since v0.3.6
1322
1580
  */
1323
1581
  function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
@@ -1373,7 +1631,7 @@ declare module 'http' {
1373
1631
  * const server = http.createServer((req, res) => {
1374
1632
  * res.writeHead(200, { 'Content-Type': 'application/json' });
1375
1633
  * res.end(JSON.stringify({
1376
- * data: 'Hello World!'
1634
+ * data: 'Hello World!',
1377
1635
  * }));
1378
1636
  * });
1379
1637
  *
@@ -1384,6 +1642,76 @@ declare module 'http' {
1384
1642
  */
1385
1643
  function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
1386
1644
  function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
1645
+ /**
1646
+ * Performs the low-level validations on the provided `name` that are done when`res.setHeader(name, value)` is called.
1647
+ *
1648
+ * Passing illegal value as `name` will result in a `TypeError` being thrown,
1649
+ * identified by `code: 'ERR_INVALID_HTTP_TOKEN'`.
1650
+ *
1651
+ * It is not necessary to use this method before passing headers to an HTTP request
1652
+ * or response. The HTTP module will automatically validate such headers.
1653
+ * Examples:
1654
+ *
1655
+ * Example:
1656
+ *
1657
+ * ```js
1658
+ * const { validateHeaderName } = require('node:http');
1659
+ *
1660
+ * try {
1661
+ * validateHeaderName('');
1662
+ * } catch (err) {
1663
+ * console.error(err instanceof TypeError); // --> true
1664
+ * console.error(err.code); // --> 'ERR_INVALID_HTTP_TOKEN'
1665
+ * console.error(err.message); // --> 'Header name must be a valid HTTP token [""]'
1666
+ * }
1667
+ * ```
1668
+ * @since v14.3.0
1669
+ * @param [label='Header name'] Label for error message.
1670
+ */
1671
+ function validateHeaderName(name: string): void;
1672
+ /**
1673
+ * Performs the low-level validations on the provided `value` that are done when`res.setHeader(name, value)` is called.
1674
+ *
1675
+ * Passing illegal value as `value` will result in a `TypeError` being thrown.
1676
+ *
1677
+ * * Undefined value error is identified by `code: 'ERR_HTTP_INVALID_HEADER_VALUE'`.
1678
+ * * Invalid value character error is identified by `code: 'ERR_INVALID_CHAR'`.
1679
+ *
1680
+ * It is not necessary to use this method before passing headers to an HTTP request
1681
+ * or response. The HTTP module will automatically validate such headers.
1682
+ *
1683
+ * Examples:
1684
+ *
1685
+ * ```js
1686
+ * const { validateHeaderValue } = require('node:http');
1687
+ *
1688
+ * try {
1689
+ * validateHeaderValue('x-my-header', undefined);
1690
+ * } catch (err) {
1691
+ * console.error(err instanceof TypeError); // --> true
1692
+ * console.error(err.code === 'ERR_HTTP_INVALID_HEADER_VALUE'); // --> true
1693
+ * console.error(err.message); // --> 'Invalid value "undefined" for header "x-my-header"'
1694
+ * }
1695
+ *
1696
+ * try {
1697
+ * validateHeaderValue('x-my-header', 'oʊmɪɡə');
1698
+ * } catch (err) {
1699
+ * console.error(err instanceof TypeError); // --> true
1700
+ * console.error(err.code === 'ERR_INVALID_CHAR'); // --> true
1701
+ * console.error(err.message); // --> 'Invalid character in header content ["x-my-header"]'
1702
+ * }
1703
+ * ```
1704
+ * @since v14.3.0
1705
+ * @param name Header name
1706
+ * @param value Header value
1707
+ */
1708
+ function validateHeaderValue(name: string, value: string): void;
1709
+ /**
1710
+ * Set the maximum number of idle HTTP parsers.
1711
+ * @since v18.8.0, v16.18.0
1712
+ * @param [max=1000]
1713
+ */
1714
+ function setMaxIdleHTTPParsers(max: number): void;
1387
1715
  let globalAgent: Agent;
1388
1716
  /**
1389
1717
  * Read-only property specifying the maximum allowed size of HTTP headers in bytes.