cdk-ecr-deployment 0.0.76 → 0.0.79

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 (356) hide show
  1. package/.jsii +28 -25
  2. package/lambda/Dockerfile +25 -0
  3. package/lambda/install.js +64 -0
  4. package/lib/index.js +40 -23
  5. package/node_modules/@sindresorhus/is/dist/index.d.ts +225 -0
  6. package/node_modules/@sindresorhus/is/dist/index.js +427 -0
  7. package/node_modules/@sindresorhus/is/dist/types.d.ts +24 -0
  8. package/node_modules/@sindresorhus/is/dist/types.js +3 -0
  9. package/node_modules/@sindresorhus/is/license +9 -0
  10. package/node_modules/@sindresorhus/is/package.json +96 -0
  11. package/node_modules/@sindresorhus/is/readme.md +628 -0
  12. package/node_modules/@szmarczak/http-timer/LICENSE +21 -0
  13. package/node_modules/@szmarczak/http-timer/README.md +93 -0
  14. package/node_modules/@szmarczak/http-timer/dist/source/index.d.ts +32 -0
  15. package/node_modules/@szmarczak/http-timer/dist/source/index.js +126 -0
  16. package/node_modules/@szmarczak/http-timer/package.json +72 -0
  17. package/node_modules/@types/cacheable-request/LICENSE +21 -0
  18. package/node_modules/@types/cacheable-request/README.md +16 -0
  19. package/node_modules/@types/cacheable-request/index.d.ts +137 -0
  20. package/node_modules/@types/cacheable-request/node_modules/@types/node/LICENSE +21 -0
  21. package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +16 -0
  22. package/node_modules/@types/cacheable-request/node_modules/@types/node/assert/strict.d.ts +8 -0
  23. package/node_modules/@types/cacheable-request/node_modules/@types/node/assert.d.ts +912 -0
  24. package/node_modules/@types/cacheable-request/node_modules/@types/node/async_hooks.d.ts +497 -0
  25. package/node_modules/@types/cacheable-request/node_modules/@types/node/buffer.d.ts +2142 -0
  26. package/node_modules/@types/cacheable-request/node_modules/@types/node/child_process.d.ts +1365 -0
  27. package/node_modules/@types/cacheable-request/node_modules/@types/node/cluster.d.ts +414 -0
  28. package/node_modules/@types/cacheable-request/node_modules/@types/node/console.d.ts +412 -0
  29. package/node_modules/@types/cacheable-request/node_modules/@types/node/constants.d.ts +18 -0
  30. package/node_modules/@types/cacheable-request/node_modules/@types/node/crypto.d.ts +3307 -0
  31. package/node_modules/@types/cacheable-request/node_modules/@types/node/dgram.d.ts +545 -0
  32. package/node_modules/@types/cacheable-request/node_modules/@types/node/diagnostics_channel.d.ts +128 -0
  33. package/node_modules/@types/cacheable-request/node_modules/@types/node/dns/promises.d.ts +357 -0
  34. package/node_modules/@types/cacheable-request/node_modules/@types/node/dns.d.ts +643 -0
  35. package/node_modules/@types/cacheable-request/node_modules/@types/node/domain.d.ts +169 -0
  36. package/node_modules/@types/cacheable-request/node_modules/@types/node/events.d.ts +623 -0
  37. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs/promises.d.ts +1004 -0
  38. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +3748 -0
  39. package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.d.ts +284 -0
  40. package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.global.d.ts +1 -0
  41. package/node_modules/@types/cacheable-request/node_modules/@types/node/http.d.ts +1368 -0
  42. package/node_modules/@types/cacheable-request/node_modules/@types/node/http2.d.ts +2100 -0
  43. package/node_modules/@types/cacheable-request/node_modules/@types/node/https.d.ts +391 -0
  44. package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +131 -0
  45. package/node_modules/@types/cacheable-request/node_modules/@types/node/inspector.d.ts +2738 -0
  46. package/node_modules/@types/cacheable-request/node_modules/@types/node/module.d.ts +114 -0
  47. package/node_modules/@types/cacheable-request/node_modules/@types/node/net.d.ts +783 -0
  48. package/node_modules/@types/cacheable-request/node_modules/@types/node/os.d.ts +455 -0
  49. package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +230 -0
  50. package/node_modules/@types/cacheable-request/node_modules/@types/node/path.d.ts +172 -0
  51. package/node_modules/@types/cacheable-request/node_modules/@types/node/perf_hooks.d.ts +555 -0
  52. package/node_modules/@types/cacheable-request/node_modules/@types/node/process.d.ts +1477 -0
  53. package/node_modules/@types/cacheable-request/node_modules/@types/node/punycode.d.ts +117 -0
  54. package/node_modules/@types/cacheable-request/node_modules/@types/node/querystring.d.ts +131 -0
  55. package/node_modules/@types/cacheable-request/node_modules/@types/node/readline.d.ts +542 -0
  56. package/node_modules/@types/cacheable-request/node_modules/@types/node/repl.d.ts +424 -0
  57. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/consumers.d.ts +24 -0
  58. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/promises.d.ts +42 -0
  59. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/web.d.ts +6 -0
  60. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream.d.ts +1249 -0
  61. package/node_modules/@types/cacheable-request/node_modules/@types/node/string_decoder.d.ts +67 -0
  62. package/node_modules/@types/cacheable-request/node_modules/@types/node/timers/promises.d.ts +68 -0
  63. package/node_modules/@types/cacheable-request/node_modules/@types/node/timers.d.ts +94 -0
  64. package/node_modules/@types/cacheable-request/node_modules/@types/node/tls.d.ts +1019 -0
  65. package/node_modules/@types/cacheable-request/node_modules/@types/node/trace_events.d.ts +161 -0
  66. package/node_modules/@types/cacheable-request/node_modules/@types/node/tty.d.ts +204 -0
  67. package/node_modules/@types/cacheable-request/node_modules/@types/node/url.d.ts +798 -0
  68. package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +1563 -0
  69. package/node_modules/@types/cacheable-request/node_modules/@types/node/v8.d.ts +378 -0
  70. package/node_modules/@types/cacheable-request/node_modules/@types/node/vm.d.ts +507 -0
  71. package/node_modules/@types/cacheable-request/node_modules/@types/node/wasi.d.ts +158 -0
  72. package/node_modules/@types/cacheable-request/node_modules/@types/node/worker_threads.d.ts +649 -0
  73. package/node_modules/@types/cacheable-request/node_modules/@types/node/zlib.d.ts +517 -0
  74. package/node_modules/@types/cacheable-request/package.json +35 -0
  75. package/node_modules/@types/http-cache-semantics/LICENSE +21 -0
  76. package/node_modules/@types/http-cache-semantics/README.md +16 -0
  77. package/node_modules/@types/http-cache-semantics/index.d.ts +170 -0
  78. package/node_modules/@types/http-cache-semantics/package.json +25 -0
  79. package/node_modules/@types/keyv/LICENSE +21 -0
  80. package/node_modules/@types/keyv/README.md +16 -0
  81. package/node_modules/@types/keyv/index.d.ts +77 -0
  82. package/node_modules/@types/keyv/node_modules/@types/node/LICENSE +21 -0
  83. package/node_modules/@types/keyv/node_modules/@types/node/README.md +16 -0
  84. package/node_modules/@types/keyv/node_modules/@types/node/assert/strict.d.ts +8 -0
  85. package/node_modules/@types/keyv/node_modules/@types/node/assert.d.ts +912 -0
  86. package/node_modules/@types/keyv/node_modules/@types/node/async_hooks.d.ts +497 -0
  87. package/node_modules/@types/keyv/node_modules/@types/node/buffer.d.ts +2142 -0
  88. package/node_modules/@types/keyv/node_modules/@types/node/child_process.d.ts +1365 -0
  89. package/node_modules/@types/keyv/node_modules/@types/node/cluster.d.ts +414 -0
  90. package/node_modules/@types/keyv/node_modules/@types/node/console.d.ts +412 -0
  91. package/node_modules/@types/keyv/node_modules/@types/node/constants.d.ts +18 -0
  92. package/node_modules/@types/keyv/node_modules/@types/node/crypto.d.ts +3307 -0
  93. package/node_modules/@types/keyv/node_modules/@types/node/dgram.d.ts +545 -0
  94. package/node_modules/@types/keyv/node_modules/@types/node/diagnostics_channel.d.ts +128 -0
  95. package/node_modules/@types/keyv/node_modules/@types/node/dns/promises.d.ts +357 -0
  96. package/node_modules/@types/keyv/node_modules/@types/node/dns.d.ts +643 -0
  97. package/node_modules/@types/keyv/node_modules/@types/node/domain.d.ts +169 -0
  98. package/node_modules/@types/keyv/node_modules/@types/node/events.d.ts +623 -0
  99. package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +1004 -0
  100. package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +3748 -0
  101. package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +284 -0
  102. package/node_modules/@types/keyv/node_modules/@types/node/globals.global.d.ts +1 -0
  103. package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +1368 -0
  104. package/node_modules/@types/keyv/node_modules/@types/node/http2.d.ts +2100 -0
  105. package/node_modules/@types/keyv/node_modules/@types/node/https.d.ts +391 -0
  106. package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +131 -0
  107. package/node_modules/@types/keyv/node_modules/@types/node/inspector.d.ts +2738 -0
  108. package/node_modules/@types/keyv/node_modules/@types/node/module.d.ts +114 -0
  109. package/node_modules/@types/keyv/node_modules/@types/node/net.d.ts +783 -0
  110. package/node_modules/@types/keyv/node_modules/@types/node/os.d.ts +455 -0
  111. package/node_modules/@types/keyv/node_modules/@types/node/package.json +230 -0
  112. package/node_modules/@types/keyv/node_modules/@types/node/path.d.ts +172 -0
  113. package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +555 -0
  114. package/node_modules/@types/keyv/node_modules/@types/node/process.d.ts +1477 -0
  115. package/node_modules/@types/keyv/node_modules/@types/node/punycode.d.ts +117 -0
  116. package/node_modules/@types/keyv/node_modules/@types/node/querystring.d.ts +131 -0
  117. package/node_modules/@types/keyv/node_modules/@types/node/readline.d.ts +542 -0
  118. package/node_modules/@types/keyv/node_modules/@types/node/repl.d.ts +424 -0
  119. package/node_modules/@types/keyv/node_modules/@types/node/stream/consumers.d.ts +24 -0
  120. package/node_modules/@types/keyv/node_modules/@types/node/stream/promises.d.ts +42 -0
  121. package/node_modules/@types/keyv/node_modules/@types/node/stream/web.d.ts +6 -0
  122. package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +1249 -0
  123. package/node_modules/@types/keyv/node_modules/@types/node/string_decoder.d.ts +67 -0
  124. package/node_modules/@types/keyv/node_modules/@types/node/timers/promises.d.ts +68 -0
  125. package/node_modules/@types/keyv/node_modules/@types/node/timers.d.ts +94 -0
  126. package/node_modules/@types/keyv/node_modules/@types/node/tls.d.ts +1019 -0
  127. package/node_modules/@types/keyv/node_modules/@types/node/trace_events.d.ts +161 -0
  128. package/node_modules/@types/keyv/node_modules/@types/node/tty.d.ts +204 -0
  129. package/node_modules/@types/keyv/node_modules/@types/node/url.d.ts +798 -0
  130. package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +1563 -0
  131. package/node_modules/@types/keyv/node_modules/@types/node/v8.d.ts +378 -0
  132. package/node_modules/@types/keyv/node_modules/@types/node/vm.d.ts +507 -0
  133. package/node_modules/@types/keyv/node_modules/@types/node/wasi.d.ts +158 -0
  134. package/node_modules/@types/keyv/node_modules/@types/node/worker_threads.d.ts +649 -0
  135. package/node_modules/@types/keyv/node_modules/@types/node/zlib.d.ts +517 -0
  136. package/node_modules/@types/keyv/package.json +32 -0
  137. package/node_modules/@types/responselike/LICENSE +21 -0
  138. package/node_modules/@types/responselike/README.md +16 -0
  139. package/node_modules/@types/responselike/index.d.ts +34 -0
  140. package/node_modules/@types/responselike/node_modules/@types/node/LICENSE +21 -0
  141. package/node_modules/@types/responselike/node_modules/@types/node/README.md +16 -0
  142. package/node_modules/@types/responselike/node_modules/@types/node/assert/strict.d.ts +8 -0
  143. package/node_modules/@types/responselike/node_modules/@types/node/assert.d.ts +912 -0
  144. package/node_modules/@types/responselike/node_modules/@types/node/async_hooks.d.ts +497 -0
  145. package/node_modules/@types/responselike/node_modules/@types/node/buffer.d.ts +2142 -0
  146. package/node_modules/@types/responselike/node_modules/@types/node/child_process.d.ts +1365 -0
  147. package/node_modules/@types/responselike/node_modules/@types/node/cluster.d.ts +414 -0
  148. package/node_modules/@types/responselike/node_modules/@types/node/console.d.ts +412 -0
  149. package/node_modules/@types/responselike/node_modules/@types/node/constants.d.ts +18 -0
  150. package/node_modules/@types/responselike/node_modules/@types/node/crypto.d.ts +3307 -0
  151. package/node_modules/@types/responselike/node_modules/@types/node/dgram.d.ts +545 -0
  152. package/node_modules/@types/responselike/node_modules/@types/node/diagnostics_channel.d.ts +128 -0
  153. package/node_modules/@types/responselike/node_modules/@types/node/dns/promises.d.ts +357 -0
  154. package/node_modules/@types/responselike/node_modules/@types/node/dns.d.ts +643 -0
  155. package/node_modules/@types/responselike/node_modules/@types/node/domain.d.ts +169 -0
  156. package/node_modules/@types/responselike/node_modules/@types/node/events.d.ts +623 -0
  157. package/node_modules/@types/responselike/node_modules/@types/node/fs/promises.d.ts +1004 -0
  158. package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +3748 -0
  159. package/node_modules/@types/responselike/node_modules/@types/node/globals.d.ts +284 -0
  160. package/node_modules/@types/responselike/node_modules/@types/node/globals.global.d.ts +1 -0
  161. package/node_modules/@types/responselike/node_modules/@types/node/http.d.ts +1368 -0
  162. package/node_modules/@types/responselike/node_modules/@types/node/http2.d.ts +2100 -0
  163. package/node_modules/@types/responselike/node_modules/@types/node/https.d.ts +391 -0
  164. package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +131 -0
  165. package/node_modules/@types/responselike/node_modules/@types/node/inspector.d.ts +2738 -0
  166. package/node_modules/@types/responselike/node_modules/@types/node/module.d.ts +114 -0
  167. package/node_modules/@types/responselike/node_modules/@types/node/net.d.ts +783 -0
  168. package/node_modules/@types/responselike/node_modules/@types/node/os.d.ts +455 -0
  169. package/node_modules/@types/responselike/node_modules/@types/node/package.json +230 -0
  170. package/node_modules/@types/responselike/node_modules/@types/node/path.d.ts +172 -0
  171. package/node_modules/@types/responselike/node_modules/@types/node/perf_hooks.d.ts +555 -0
  172. package/node_modules/@types/responselike/node_modules/@types/node/process.d.ts +1477 -0
  173. package/node_modules/@types/responselike/node_modules/@types/node/punycode.d.ts +117 -0
  174. package/node_modules/@types/responselike/node_modules/@types/node/querystring.d.ts +131 -0
  175. package/node_modules/@types/responselike/node_modules/@types/node/readline.d.ts +542 -0
  176. package/node_modules/@types/responselike/node_modules/@types/node/repl.d.ts +424 -0
  177. package/node_modules/@types/responselike/node_modules/@types/node/stream/consumers.d.ts +24 -0
  178. package/node_modules/@types/responselike/node_modules/@types/node/stream/promises.d.ts +42 -0
  179. package/node_modules/@types/responselike/node_modules/@types/node/stream/web.d.ts +6 -0
  180. package/node_modules/@types/responselike/node_modules/@types/node/stream.d.ts +1249 -0
  181. package/node_modules/@types/responselike/node_modules/@types/node/string_decoder.d.ts +67 -0
  182. package/node_modules/@types/responselike/node_modules/@types/node/timers/promises.d.ts +68 -0
  183. package/node_modules/@types/responselike/node_modules/@types/node/timers.d.ts +94 -0
  184. package/node_modules/@types/responselike/node_modules/@types/node/tls.d.ts +1019 -0
  185. package/node_modules/@types/responselike/node_modules/@types/node/trace_events.d.ts +161 -0
  186. package/node_modules/@types/responselike/node_modules/@types/node/tty.d.ts +204 -0
  187. package/node_modules/@types/responselike/node_modules/@types/node/url.d.ts +798 -0
  188. package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +1563 -0
  189. package/node_modules/@types/responselike/node_modules/@types/node/v8.d.ts +378 -0
  190. package/node_modules/@types/responselike/node_modules/@types/node/vm.d.ts +507 -0
  191. package/node_modules/@types/responselike/node_modules/@types/node/wasi.d.ts +158 -0
  192. package/node_modules/@types/responselike/node_modules/@types/node/worker_threads.d.ts +649 -0
  193. package/node_modules/@types/responselike/node_modules/@types/node/zlib.d.ts +517 -0
  194. package/node_modules/@types/responselike/package.json +25 -0
  195. package/node_modules/cacheable-lookup/LICENSE +21 -0
  196. package/node_modules/cacheable-lookup/README.md +240 -0
  197. package/node_modules/cacheable-lookup/index.d.ts +139 -0
  198. package/node_modules/cacheable-lookup/package.json +45 -0
  199. package/node_modules/cacheable-lookup/source/index.js +436 -0
  200. package/node_modules/cacheable-request/LICENSE +21 -0
  201. package/node_modules/cacheable-request/README.md +206 -0
  202. package/node_modules/cacheable-request/package.json +56 -0
  203. package/node_modules/cacheable-request/src/index.js +251 -0
  204. package/node_modules/clone-response/LICENSE +21 -0
  205. package/node_modules/clone-response/README.md +62 -0
  206. package/node_modules/clone-response/package.json +44 -0
  207. package/node_modules/clone-response/src/index.js +17 -0
  208. package/node_modules/decompress-response/index.d.ts +22 -0
  209. package/node_modules/decompress-response/index.js +58 -0
  210. package/node_modules/decompress-response/license +9 -0
  211. package/node_modules/decompress-response/node_modules/mimic-response/index.d.ts +17 -0
  212. package/node_modules/decompress-response/node_modules/mimic-response/index.js +77 -0
  213. package/node_modules/decompress-response/node_modules/mimic-response/license +9 -0
  214. package/node_modules/decompress-response/node_modules/mimic-response/package.json +42 -0
  215. package/node_modules/decompress-response/node_modules/mimic-response/readme.md +78 -0
  216. package/node_modules/decompress-response/package.json +56 -0
  217. package/node_modules/decompress-response/readme.md +48 -0
  218. package/node_modules/defer-to-connect/LICENSE +21 -0
  219. package/node_modules/defer-to-connect/README.md +38 -0
  220. package/node_modules/defer-to-connect/dist/source/index.d.ts +10 -0
  221. package/node_modules/defer-to-connect/dist/source/index.js +47 -0
  222. package/node_modules/defer-to-connect/package.json +71 -0
  223. package/node_modules/end-of-stream/LICENSE +21 -0
  224. package/node_modules/end-of-stream/README.md +54 -0
  225. package/node_modules/end-of-stream/index.js +94 -0
  226. package/node_modules/end-of-stream/package.json +37 -0
  227. package/node_modules/get-stream/buffer-stream.js +52 -0
  228. package/node_modules/get-stream/index.d.ts +108 -0
  229. package/node_modules/get-stream/index.js +60 -0
  230. package/node_modules/get-stream/license +9 -0
  231. package/node_modules/get-stream/package.json +50 -0
  232. package/node_modules/get-stream/readme.md +124 -0
  233. package/node_modules/got/dist/source/as-promise/create-rejection.d.ts +2 -0
  234. package/node_modules/got/dist/source/as-promise/create-rejection.js +30 -0
  235. package/node_modules/got/dist/source/as-promise/index.d.ts +3 -0
  236. package/node_modules/got/dist/source/as-promise/index.js +175 -0
  237. package/node_modules/got/dist/source/as-promise/normalize-arguments.d.ts +3 -0
  238. package/node_modules/got/dist/source/as-promise/normalize-arguments.js +78 -0
  239. package/node_modules/got/dist/source/as-promise/parse-body.d.ts +3 -0
  240. package/node_modules/got/dist/source/as-promise/parse-body.js +25 -0
  241. package/node_modules/got/dist/source/as-promise/types.d.ts +256 -0
  242. package/node_modules/got/dist/source/as-promise/types.js +40 -0
  243. package/node_modules/got/dist/source/core/calculate-retry-delay.d.ts +5 -0
  244. package/node_modules/got/dist/source/core/calculate-retry-delay.js +29 -0
  245. package/node_modules/got/dist/source/core/index.d.ts +1124 -0
  246. package/node_modules/got/dist/source/core/index.js +1491 -0
  247. package/node_modules/got/dist/source/core/utils/dns-ip-version.d.ts +5 -0
  248. package/node_modules/got/dist/source/core/utils/dns-ip-version.js +17 -0
  249. package/node_modules/got/dist/source/core/utils/get-body-size.d.ts +3 -0
  250. package/node_modules/got/dist/source/core/utils/get-body-size.js +32 -0
  251. package/node_modules/got/dist/source/core/utils/get-buffer.d.ts +4 -0
  252. package/node_modules/got/dist/source/core/utils/get-buffer.js +16 -0
  253. package/node_modules/got/dist/source/core/utils/is-form-data.d.ts +8 -0
  254. package/node_modules/got/dist/source/core/utils/is-form-data.js +4 -0
  255. package/node_modules/got/dist/source/core/utils/is-response-ok.d.ts +2 -0
  256. package/node_modules/got/dist/source/core/utils/is-response-ok.js +8 -0
  257. package/node_modules/got/dist/source/core/utils/options-to-url.d.ts +14 -0
  258. package/node_modules/got/dist/source/core/utils/options-to-url.js +53 -0
  259. package/node_modules/got/dist/source/core/utils/proxy-events.d.ts +3 -0
  260. package/node_modules/got/dist/source/core/utils/proxy-events.js +17 -0
  261. package/node_modules/got/dist/source/core/utils/timed-out.d.ts +29 -0
  262. package/node_modules/got/dist/source/core/utils/timed-out.js +121 -0
  263. package/node_modules/got/dist/source/core/utils/unhandle.d.ts +11 -0
  264. package/node_modules/got/dist/source/core/utils/unhandle.js +22 -0
  265. package/node_modules/got/dist/source/core/utils/url-to-options.d.ts +15 -0
  266. package/node_modules/got/dist/source/core/utils/url-to-options.js +24 -0
  267. package/node_modules/got/dist/source/core/utils/weakable-map.d.ts +8 -0
  268. package/node_modules/got/dist/source/core/utils/weakable-map.js +29 -0
  269. package/node_modules/got/dist/source/create.d.ts +5 -0
  270. package/node_modules/got/dist/source/create.js +240 -0
  271. package/node_modules/got/dist/source/index.d.ts +4 -0
  272. package/node_modules/got/dist/source/index.js +132 -0
  273. package/node_modules/got/dist/source/types.d.ts +342 -0
  274. package/node_modules/got/dist/source/types.js +2 -0
  275. package/node_modules/got/dist/source/utils/deep-freeze.d.ts +1 -0
  276. package/node_modules/got/dist/source/utils/deep-freeze.js +12 -0
  277. package/node_modules/got/dist/source/utils/deprecation-warning.d.ts +2 -0
  278. package/node_modules/got/dist/source/utils/deprecation-warning.js +13 -0
  279. package/node_modules/got/license +9 -0
  280. package/node_modules/got/package.json +130 -0
  281. package/node_modules/got/readme.md +2476 -0
  282. package/node_modules/http-cache-semantics/LICENSE +9 -0
  283. package/node_modules/http-cache-semantics/README.md +203 -0
  284. package/node_modules/http-cache-semantics/index.js +673 -0
  285. package/node_modules/http-cache-semantics/package.json +24 -0
  286. package/node_modules/http2-wrapper/LICENSE +21 -0
  287. package/node_modules/http2-wrapper/README.md +470 -0
  288. package/node_modules/http2-wrapper/package.json +54 -0
  289. package/node_modules/http2-wrapper/source/agent.js +670 -0
  290. package/node_modules/http2-wrapper/source/auto.js +149 -0
  291. package/node_modules/http2-wrapper/source/client-request.js +445 -0
  292. package/node_modules/http2-wrapper/source/incoming-message.js +58 -0
  293. package/node_modules/http2-wrapper/source/index.js +28 -0
  294. package/node_modules/http2-wrapper/source/utils/calculate-server-name.js +27 -0
  295. package/node_modules/http2-wrapper/source/utils/errors.js +45 -0
  296. package/node_modules/http2-wrapper/source/utils/is-request-pseudo-header.js +13 -0
  297. package/node_modules/http2-wrapper/source/utils/proxy-events.js +7 -0
  298. package/node_modules/http2-wrapper/source/utils/url-to-options.js +25 -0
  299. package/node_modules/json-buffer/.travis.yml +3 -0
  300. package/node_modules/json-buffer/LICENSE +22 -0
  301. package/node_modules/json-buffer/README.md +24 -0
  302. package/node_modules/json-buffer/index.js +58 -0
  303. package/node_modules/json-buffer/package.json +34 -0
  304. package/node_modules/json-buffer/test/index.js +63 -0
  305. package/node_modules/keyv/LICENSE +21 -0
  306. package/node_modules/keyv/README.md +288 -0
  307. package/node_modules/keyv/package.json +49 -0
  308. package/node_modules/keyv/src/index.js +111 -0
  309. package/node_modules/lowercase-keys/index.d.ts +16 -0
  310. package/node_modules/lowercase-keys/index.js +10 -0
  311. package/node_modules/lowercase-keys/license +9 -0
  312. package/node_modules/lowercase-keys/package.json +38 -0
  313. package/node_modules/lowercase-keys/readme.md +32 -0
  314. package/node_modules/mimic-response/index.js +32 -0
  315. package/node_modules/mimic-response/license +9 -0
  316. package/node_modules/mimic-response/package.json +37 -0
  317. package/node_modules/mimic-response/readme.md +54 -0
  318. package/node_modules/normalize-url/index.d.ts +267 -0
  319. package/node_modules/normalize-url/index.js +216 -0
  320. package/node_modules/normalize-url/license +9 -0
  321. package/node_modules/normalize-url/package.json +50 -0
  322. package/node_modules/normalize-url/readme.md +286 -0
  323. package/node_modules/once/LICENSE +15 -0
  324. package/node_modules/once/README.md +79 -0
  325. package/node_modules/once/once.js +42 -0
  326. package/node_modules/once/package.json +33 -0
  327. package/node_modules/p-cancelable/index.d.ts +176 -0
  328. package/node_modules/p-cancelable/index.js +111 -0
  329. package/node_modules/p-cancelable/license +9 -0
  330. package/node_modules/p-cancelable/package.json +49 -0
  331. package/node_modules/p-cancelable/readme.md +153 -0
  332. package/node_modules/pump/.travis.yml +5 -0
  333. package/node_modules/pump/LICENSE +21 -0
  334. package/node_modules/pump/README.md +65 -0
  335. package/node_modules/pump/index.js +82 -0
  336. package/node_modules/pump/package.json +24 -0
  337. package/node_modules/pump/test-browser.js +66 -0
  338. package/node_modules/pump/test-node.js +53 -0
  339. package/node_modules/quick-lru/index.d.ts +97 -0
  340. package/node_modules/quick-lru/index.js +123 -0
  341. package/node_modules/quick-lru/license +9 -0
  342. package/node_modules/quick-lru/package.json +43 -0
  343. package/node_modules/quick-lru/readme.md +111 -0
  344. package/node_modules/resolve-alpn/LICENSE +22 -0
  345. package/node_modules/resolve-alpn/README.md +60 -0
  346. package/node_modules/resolve-alpn/index.js +43 -0
  347. package/node_modules/resolve-alpn/package.json +34 -0
  348. package/node_modules/responselike/LICENSE +19 -0
  349. package/node_modules/responselike/README.md +77 -0
  350. package/node_modules/responselike/package.json +38 -0
  351. package/node_modules/responselike/src/index.js +34 -0
  352. package/node_modules/wrappy/LICENSE +15 -0
  353. package/node_modules/wrappy/README.md +36 -0
  354. package/node_modules/wrappy/package.json +29 -0
  355. package/node_modules/wrappy/wrappy.js +33 -0
  356. package/package.json +7 -4
@@ -0,0 +1,1368 @@
1
+ /**
2
+ * To use the HTTP server and client one must `require('http')`.
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
+ * ```js
13
+ * { 'content-length': '123',
14
+ * 'content-type': 'text/plain',
15
+ * 'connection': 'keep-alive',
16
+ * 'host': 'mysite.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', 'mysite.com',
38
+ * 'accepT', '*' ]
39
+ * ```
40
+ * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/http.js)
41
+ */
42
+ declare module 'http' {
43
+ import * as stream from 'node:stream';
44
+ import { URL } from 'node:url';
45
+ import { Socket, Server as NetServer } from 'node:net';
46
+ // incoming headers will never contain number
47
+ interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> {
48
+ accept?: string | undefined;
49
+ 'accept-language'?: string | undefined;
50
+ 'accept-patch'?: string | undefined;
51
+ 'accept-ranges'?: string | undefined;
52
+ 'access-control-allow-credentials'?: string | undefined;
53
+ 'access-control-allow-headers'?: string | undefined;
54
+ 'access-control-allow-methods'?: string | undefined;
55
+ 'access-control-allow-origin'?: string | undefined;
56
+ 'access-control-expose-headers'?: string | undefined;
57
+ 'access-control-max-age'?: string | undefined;
58
+ 'access-control-request-headers'?: string | undefined;
59
+ 'access-control-request-method'?: string | undefined;
60
+ age?: string | undefined;
61
+ allow?: string | undefined;
62
+ 'alt-svc'?: string | undefined;
63
+ authorization?: string | undefined;
64
+ 'cache-control'?: string | undefined;
65
+ connection?: string | undefined;
66
+ 'content-disposition'?: string | undefined;
67
+ 'content-encoding'?: string | undefined;
68
+ 'content-language'?: string | undefined;
69
+ 'content-length'?: string | undefined;
70
+ 'content-location'?: string | undefined;
71
+ 'content-range'?: string | undefined;
72
+ 'content-type'?: string | undefined;
73
+ cookie?: string | undefined;
74
+ date?: string | undefined;
75
+ etag?: string | undefined;
76
+ expect?: string | undefined;
77
+ expires?: string | undefined;
78
+ forwarded?: string | undefined;
79
+ from?: string | undefined;
80
+ host?: string | undefined;
81
+ 'if-match'?: string | undefined;
82
+ 'if-modified-since'?: string | undefined;
83
+ 'if-none-match'?: string | undefined;
84
+ 'if-unmodified-since'?: string | undefined;
85
+ 'last-modified'?: string | undefined;
86
+ location?: string | undefined;
87
+ origin?: string | undefined;
88
+ pragma?: string | undefined;
89
+ 'proxy-authenticate'?: string | undefined;
90
+ 'proxy-authorization'?: string | undefined;
91
+ 'public-key-pins'?: string | undefined;
92
+ range?: string | undefined;
93
+ referer?: string | undefined;
94
+ 'retry-after'?: string | undefined;
95
+ 'sec-websocket-accept'?: string | undefined;
96
+ 'sec-websocket-extensions'?: string | undefined;
97
+ 'sec-websocket-key'?: string | undefined;
98
+ 'sec-websocket-protocol'?: string | undefined;
99
+ 'sec-websocket-version'?: string | undefined;
100
+ 'set-cookie'?: string[] | undefined;
101
+ 'strict-transport-security'?: string | undefined;
102
+ tk?: string | undefined;
103
+ trailer?: string | undefined;
104
+ 'transfer-encoding'?: string | undefined;
105
+ upgrade?: string | undefined;
106
+ 'user-agent'?: string | undefined;
107
+ vary?: string | undefined;
108
+ via?: string | undefined;
109
+ warning?: string | undefined;
110
+ 'www-authenticate'?: string | undefined;
111
+ }
112
+ // outgoing headers allows numbers (as they are converted internally to strings)
113
+ type OutgoingHttpHeader = number | string | string[];
114
+ interface OutgoingHttpHeaders extends NodeJS.Dict<OutgoingHttpHeader> {}
115
+ interface ClientRequestArgs {
116
+ abort?: AbortSignal | undefined;
117
+ protocol?: string | null | undefined;
118
+ host?: string | null | undefined;
119
+ hostname?: string | null | undefined;
120
+ family?: number | undefined;
121
+ port?: number | string | null | undefined;
122
+ defaultPort?: number | string | undefined;
123
+ localAddress?: string | undefined;
124
+ socketPath?: string | undefined;
125
+ /**
126
+ * @default 8192
127
+ */
128
+ maxHeaderSize?: number | undefined;
129
+ method?: string | undefined;
130
+ 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;
136
+ 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
+ }
140
+ interface ServerOptions {
141
+ IncomingMessage?: typeof IncomingMessage | undefined;
142
+ ServerResponse?: typeof ServerResponse | undefined;
143
+ /**
144
+ * Optionally overrides the value of
145
+ * `--max-http-header-size` for requests received by this server, i.e.
146
+ * the maximum length of request headers in bytes.
147
+ * @default 8192
148
+ */
149
+ maxHeaderSize?: number | undefined;
150
+ /**
151
+ * Use an insecure HTTP parser that accepts invalid HTTP headers when true.
152
+ * Using the insecure parser should be avoided.
153
+ * See --insecure-http-parser for more information.
154
+ * @default false
155
+ */
156
+ insecureHTTPParser?: boolean | undefined;
157
+ }
158
+ type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
159
+ /**
160
+ * @since v0.1.17
161
+ */
162
+ class Server extends NetServer {
163
+ constructor(requestListener?: RequestListener);
164
+ constructor(options: ServerOptions, requestListener?: RequestListener);
165
+ /**
166
+ * Sets the timeout value for sockets, and emits a `'timeout'` event on
167
+ * the Server object, passing the socket as an argument, if a timeout
168
+ * occurs.
169
+ *
170
+ * If there is a `'timeout'` event listener on the Server object, then it
171
+ * will be called with the timed-out socket as an argument.
172
+ *
173
+ * By default, the Server does not timeout sockets. However, if a callback
174
+ * is assigned to the Server's `'timeout'` event, timeouts must be handled
175
+ * explicitly.
176
+ * @since v0.9.12
177
+ * @param [msecs=0 (no timeout)]
178
+ */
179
+ setTimeout(msecs?: number, callback?: () => void): this;
180
+ setTimeout(callback: () => void): this;
181
+ /**
182
+ * Limits maximum incoming headers count. If set to 0, no limit will be applied.
183
+ * @since v0.7.0
184
+ */
185
+ maxHeadersCount: number | null;
186
+ /**
187
+ * The maximum number of requests socket can handle
188
+ * before closing keep alive connection.
189
+ *
190
+ * A value of `null` will disable the limit.
191
+ *
192
+ * When limit is reach it will set `Connection` header value to `closed`,
193
+ * but will not actually close the connection, subsequent requests sent
194
+ * after the limit is reached will get `503 Service Unavailable` as a response.
195
+ * @since v16.10.0
196
+ */
197
+ maxRequestsPerSocket: number | null;
198
+ /**
199
+ * The number of milliseconds of inactivity before a socket is presumed
200
+ * to have timed out.
201
+ *
202
+ * A value of `0` will disable the timeout behavior on incoming connections.
203
+ *
204
+ * The socket timeout logic is set up on connection, so changing this
205
+ * value only affects new connections to the server, not any existing connections.
206
+ * @since v0.9.12
207
+ */
208
+ timeout: number;
209
+ /**
210
+ * Limit the amount of time the parser will wait to receive the complete HTTP
211
+ * headers.
212
+ *
213
+ * In case of inactivity, the rules defined in `server.timeout` apply. However,
214
+ * that inactivity based timeout would still allow the connection to be kept open
215
+ * if the headers are being sent very slowly (by default, up to a byte per 2
216
+ * minutes). In order to prevent this, whenever header data arrives an additional
217
+ * check is made that more than `server.headersTimeout` milliseconds has not
218
+ * 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.
219
+ * See `server.timeout` for more information on how timeout behavior can be
220
+ * customized.
221
+ * @since v11.3.0, v10.14.0
222
+ */
223
+ headersTimeout: number;
224
+ /**
225
+ * The number of milliseconds of inactivity a server needs to wait for additional
226
+ * incoming data, after it has finished writing the last response, before a socket
227
+ * will be destroyed. If the server receives new data before the keep-alive
228
+ * timeout has fired, it will reset the regular inactivity timeout, i.e.,`server.timeout`.
229
+ *
230
+ * A value of `0` will disable the keep-alive timeout behavior on incoming
231
+ * connections.
232
+ * A value of `0` makes the http server behave similarly to Node.js versions prior
233
+ * to 8.0.0, which did not have a keep-alive timeout.
234
+ *
235
+ * The socket timeout logic is set up on connection, so changing this value only
236
+ * affects new connections to the server, not any existing connections.
237
+ * @since v8.0.0
238
+ */
239
+ keepAliveTimeout: number;
240
+ /**
241
+ * Sets the timeout value in milliseconds for receiving the entire request from
242
+ * the client.
243
+ *
244
+ * If the timeout expires, the server responds with status 408 without
245
+ * forwarding the request to the request listener and then closes the connection.
246
+ *
247
+ * It must be set to a non-zero value (e.g. 120 seconds) to protect against
248
+ * potential Denial-of-Service attacks in case the server is deployed without a
249
+ * reverse proxy in front.
250
+ * @since v14.11.0
251
+ */
252
+ requestTimeout: number;
253
+ addListener(event: string, listener: (...args: any[]) => void): this;
254
+ addListener(event: 'close', listener: () => void): this;
255
+ addListener(event: 'connection', listener: (socket: Socket) => void): this;
256
+ addListener(event: 'error', listener: (err: Error) => void): this;
257
+ addListener(event: 'listening', listener: () => void): this;
258
+ addListener(event: 'checkContinue', listener: RequestListener): this;
259
+ addListener(event: 'checkExpectation', listener: RequestListener): this;
260
+ addListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
261
+ addListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
262
+ addListener(event: 'request', listener: RequestListener): this;
263
+ addListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
264
+ emit(event: string, ...args: any[]): boolean;
265
+ emit(event: 'close'): boolean;
266
+ emit(event: 'connection', socket: Socket): boolean;
267
+ emit(event: 'error', err: Error): boolean;
268
+ emit(event: 'listening'): boolean;
269
+ emit(event: 'checkContinue', req: IncomingMessage, res: ServerResponse): boolean;
270
+ emit(event: 'checkExpectation', req: IncomingMessage, res: ServerResponse): boolean;
271
+ emit(event: 'clientError', err: Error, socket: stream.Duplex): boolean;
272
+ emit(event: 'connect', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean;
273
+ emit(event: 'request', req: IncomingMessage, res: ServerResponse): boolean;
274
+ emit(event: 'upgrade', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean;
275
+ on(event: string, listener: (...args: any[]) => void): this;
276
+ on(event: 'close', listener: () => void): this;
277
+ on(event: 'connection', listener: (socket: Socket) => void): this;
278
+ on(event: 'error', listener: (err: Error) => void): this;
279
+ on(event: 'listening', listener: () => void): this;
280
+ on(event: 'checkContinue', listener: RequestListener): this;
281
+ on(event: 'checkExpectation', listener: RequestListener): this;
282
+ on(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
283
+ on(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
284
+ on(event: 'request', listener: RequestListener): this;
285
+ on(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
286
+ once(event: string, listener: (...args: any[]) => void): this;
287
+ once(event: 'close', listener: () => void): this;
288
+ once(event: 'connection', listener: (socket: Socket) => void): this;
289
+ once(event: 'error', listener: (err: Error) => void): this;
290
+ once(event: 'listening', listener: () => void): this;
291
+ once(event: 'checkContinue', listener: RequestListener): this;
292
+ once(event: 'checkExpectation', listener: RequestListener): this;
293
+ once(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
294
+ once(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
295
+ once(event: 'request', listener: RequestListener): this;
296
+ once(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
297
+ prependListener(event: string, listener: (...args: any[]) => void): this;
298
+ prependListener(event: 'close', listener: () => void): this;
299
+ prependListener(event: 'connection', listener: (socket: Socket) => void): this;
300
+ prependListener(event: 'error', listener: (err: Error) => void): this;
301
+ prependListener(event: 'listening', listener: () => void): this;
302
+ prependListener(event: 'checkContinue', listener: RequestListener): this;
303
+ prependListener(event: 'checkExpectation', listener: RequestListener): this;
304
+ prependListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
305
+ prependListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
306
+ prependListener(event: 'request', listener: RequestListener): this;
307
+ prependListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
308
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
309
+ prependOnceListener(event: 'close', listener: () => void): this;
310
+ prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this;
311
+ prependOnceListener(event: 'error', listener: (err: Error) => void): this;
312
+ prependOnceListener(event: 'listening', listener: () => void): this;
313
+ prependOnceListener(event: 'checkContinue', listener: RequestListener): this;
314
+ prependOnceListener(event: 'checkExpectation', listener: RequestListener): this;
315
+ prependOnceListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
316
+ prependOnceListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
317
+ prependOnceListener(event: 'request', listener: RequestListener): this;
318
+ prependOnceListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
319
+ }
320
+ /**
321
+ * This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract of outgoing message from
322
+ * the perspective of the participants of HTTP transaction.
323
+ * @since v0.1.17
324
+ */
325
+ class OutgoingMessage extends stream.Writable {
326
+ readonly req: IncomingMessage;
327
+ chunkedEncoding: boolean;
328
+ shouldKeepAlive: boolean;
329
+ useChunkedEncodingByDefault: boolean;
330
+ sendDate: boolean;
331
+ /**
332
+ * @deprecated Use `writableEnded` instead.
333
+ */
334
+ finished: boolean;
335
+ /**
336
+ * Read-only. `true` if the headers were sent, otherwise `false`.
337
+ * @since v0.9.3
338
+ */
339
+ readonly headersSent: boolean;
340
+ /**
341
+ * Aliases of `outgoingMessage.socket`
342
+ * @since v0.3.0
343
+ * @deprecated Since v15.12.0 - Use `socket` instead.
344
+ */
345
+ readonly connection: Socket | null;
346
+ /**
347
+ * Reference to the underlying socket. Usually, users will not want to access
348
+ * this property.
349
+ *
350
+ * After calling `outgoingMessage.end()`, this property will be nulled.
351
+ * @since v0.3.0
352
+ */
353
+ readonly socket: Socket | null;
354
+ constructor();
355
+ /**
356
+ * Once a socket is associated with the message and is connected,`socket.setTimeout()` will be called with `msecs` as the first parameter.
357
+ * @since v0.9.12
358
+ * @param callback Optional function to be called when a timeout occurs. Same as binding to the `timeout` event.
359
+ */
360
+ setTimeout(msecs: number, callback?: () => void): this;
361
+ /**
362
+ * Sets a single header value for the header object.
363
+ * @since v0.4.0
364
+ * @param name Header name
365
+ * @param value Header value
366
+ */
367
+ setHeader(name: string, value: number | string | ReadonlyArray<string>): this;
368
+ /**
369
+ * Gets the value of HTTP header with the given name. If such a name doesn't
370
+ * exist in message, it will be `undefined`.
371
+ * @since v0.4.0
372
+ * @param name Name of header
373
+ */
374
+ getHeader(name: string): number | string | string[] | undefined;
375
+ /**
376
+ * Returns a shallow copy of the current outgoing headers. Since a shallow
377
+ * copy is used, array values may be mutated without additional calls to
378
+ * various header-related HTTP module methods. The keys of the returned
379
+ * object are the header names and the values are the respective header
380
+ * values. All header names are lowercase.
381
+ *
382
+ * The object returned by the `outgoingMessage.getHeaders()` method does
383
+ * not prototypically inherit from the JavaScript Object. This means that
384
+ * typical Object methods such as `obj.toString()`, `obj.hasOwnProperty()`,
385
+ * and others are not defined and will not work.
386
+ *
387
+ * ```js
388
+ * outgoingMessage.setHeader('Foo', 'bar');
389
+ * outgoingMessage.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);
390
+ *
391
+ * const headers = outgoingMessage.getHeaders();
392
+ * // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] }
393
+ * ```
394
+ * @since v8.0.0
395
+ */
396
+ getHeaders(): OutgoingHttpHeaders;
397
+ /**
398
+ * Returns an array of names of headers of the outgoing outgoingMessage. All
399
+ * names are lowercase.
400
+ * @since v8.0.0
401
+ */
402
+ getHeaderNames(): string[];
403
+ /**
404
+ * Returns `true` if the header identified by `name` is currently set in the
405
+ * outgoing headers. The header name is case-insensitive.
406
+ *
407
+ * ```js
408
+ * const hasContentType = outgoingMessage.hasHeader('content-type');
409
+ * ```
410
+ * @since v8.0.0
411
+ */
412
+ hasHeader(name: string): boolean;
413
+ /**
414
+ * Removes a header that is queued for implicit sending.
415
+ *
416
+ * ```js
417
+ * outgoingMessage.removeHeader('Content-Encoding');
418
+ * ```
419
+ * @since v0.4.0
420
+ */
421
+ removeHeader(name: string): void;
422
+ /**
423
+ * Adds HTTP trailers (headers but at the end of the message) to the message.
424
+ *
425
+ * Trailers are **only** be emitted if the message is chunked encoded. If not,
426
+ * the trailer will be silently discarded.
427
+ *
428
+ * HTTP requires the `Trailer` header to be sent to emit trailers,
429
+ * with a list of header fields in its value, e.g.
430
+ *
431
+ * ```js
432
+ * message.writeHead(200, { 'Content-Type': 'text/plain',
433
+ * 'Trailer': 'Content-MD5' });
434
+ * message.write(fileData);
435
+ * message.addTrailers({ 'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667' });
436
+ * message.end();
437
+ * ```
438
+ *
439
+ * Attempting to set a header field name or value that contains invalid characters
440
+ * will result in a `TypeError` being thrown.
441
+ * @since v0.3.0
442
+ */
443
+ addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void;
444
+ /**
445
+ * Compulsorily flushes the message headers
446
+ *
447
+ * For efficiency reason, Node.js normally buffers the message headers
448
+ * until `outgoingMessage.end()` is called or the first chunk of message data
449
+ * is written. It then tries to pack the headers and data into a single TCP
450
+ * packet.
451
+ *
452
+ * It is usually desired (it saves a TCP round-trip), but not when the first
453
+ * data is not sent until possibly much later. `outgoingMessage.flushHeaders()`bypasses the optimization and kickstarts the request.
454
+ * @since v1.6.0
455
+ */
456
+ flushHeaders(): void;
457
+ }
458
+ /**
459
+ * This object is created internally by an HTTP server, not by the user. It is
460
+ * passed as the second parameter to the `'request'` event.
461
+ * @since v0.1.17
462
+ */
463
+ class ServerResponse extends OutgoingMessage {
464
+ /**
465
+ * When using implicit headers (not calling `response.writeHead()` explicitly),
466
+ * this property controls the status code that will be sent to the client when
467
+ * the headers get flushed.
468
+ *
469
+ * ```js
470
+ * response.statusCode = 404;
471
+ * ```
472
+ *
473
+ * After response header was sent to the client, this property indicates the
474
+ * status code which was sent out.
475
+ * @since v0.4.0
476
+ */
477
+ statusCode: number;
478
+ /**
479
+ * When using implicit headers (not calling `response.writeHead()` explicitly),
480
+ * this property controls the status message that will be sent to the client when
481
+ * the headers get flushed. If this is left as `undefined` then the standard
482
+ * message for the status code will be used.
483
+ *
484
+ * ```js
485
+ * response.statusMessage = 'Not found';
486
+ * ```
487
+ *
488
+ * After response header was sent to the client, this property indicates the
489
+ * status message which was sent out.
490
+ * @since v0.11.8
491
+ */
492
+ statusMessage: string;
493
+ constructor(req: IncomingMessage);
494
+ assignSocket(socket: Socket): void;
495
+ detachSocket(socket: Socket): void;
496
+ /**
497
+ * Sends a HTTP/1.1 100 Continue message to the client, indicating that
498
+ * the request body should be sent. See the `'checkContinue'` event on`Server`.
499
+ * @since v0.3.0
500
+ */
501
+ writeContinue(callback?: () => void): void;
502
+ /**
503
+ * Sends a response header to the request. The status code is a 3-digit HTTP
504
+ * status code, like `404`. The last argument, `headers`, are the response headers.
505
+ * Optionally one can give a human-readable `statusMessage` as the second
506
+ * argument.
507
+ *
508
+ * `headers` may be an `Array` where the keys and values are in the same list.
509
+ * It is _not_ a list of tuples. So, the even-numbered offsets are key values,
510
+ * and the odd-numbered offsets are the associated values. The array is in the same
511
+ * format as `request.rawHeaders`.
512
+ *
513
+ * Returns a reference to the `ServerResponse`, so that calls can be chained.
514
+ *
515
+ * ```js
516
+ * const body = 'hello world';
517
+ * response
518
+ * .writeHead(200, {
519
+ * 'Content-Length': Buffer.byteLength(body),
520
+ * 'Content-Type': 'text/plain'
521
+ * })
522
+ * .end(body);
523
+ * ```
524
+ *
525
+ * This method must only be called once on a message and it must
526
+ * be called before `response.end()` is called.
527
+ *
528
+ * If `response.write()` or `response.end()` are called before calling
529
+ * this, the implicit/mutable headers will be calculated and call this function.
530
+ *
531
+ * When headers have been set with `response.setHeader()`, they will be merged
532
+ * with any headers passed to `response.writeHead()`, with the headers passed
533
+ * to `response.writeHead()` given precedence.
534
+ *
535
+ * If this method is called and `response.setHeader()` has not been called,
536
+ * it will directly write the supplied header values onto the network channel
537
+ * without caching internally, and the `response.getHeader()` on the header
538
+ * will not yield the expected result. If progressive population of headers is
539
+ * desired with potential future retrieval and modification, use `response.setHeader()` instead.
540
+ *
541
+ * ```js
542
+ * // Returns content-type = text/plain
543
+ * const server = http.createServer((req, res) => {
544
+ * res.setHeader('Content-Type', 'text/html');
545
+ * res.setHeader('X-Foo', 'bar');
546
+ * res.writeHead(200, { 'Content-Type': 'text/plain' });
547
+ * res.end('ok');
548
+ * });
549
+ * ```
550
+ *
551
+ * `Content-Length` is given in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. Node.js
552
+ * does not check whether `Content-Length` and the length of the body which has
553
+ * been transmitted are equal or not.
554
+ *
555
+ * Attempting to set a header field name or value that contains invalid characters
556
+ * will result in a `TypeError` being thrown.
557
+ * @since v0.1.30
558
+ */
559
+ writeHead(statusCode: number, statusMessage?: string, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
560
+ writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
561
+ /**
562
+ * Sends a HTTP/1.1 102 Processing message to the client, indicating that
563
+ * the request body should be sent.
564
+ * @since v10.0.0
565
+ */
566
+ writeProcessing(): void;
567
+ }
568
+ interface InformationEvent {
569
+ statusCode: number;
570
+ statusMessage: string;
571
+ httpVersion: string;
572
+ httpVersionMajor: number;
573
+ httpVersionMinor: number;
574
+ headers: IncomingHttpHeaders;
575
+ rawHeaders: string[];
576
+ }
577
+ /**
578
+ * This object is created internally and returned from {@link request}. It
579
+ * represents an _in-progress_ request whose header has already been queued. The
580
+ * header is still mutable using the `setHeader(name, value)`,`getHeader(name)`, `removeHeader(name)` API. The actual header will
581
+ * be sent along with the first data chunk or when calling `request.end()`.
582
+ *
583
+ * To get the response, add a listener for `'response'` to the request object.`'response'` will be emitted from the request object when the response
584
+ * headers have been received. The `'response'` event is executed with one
585
+ * argument which is an instance of {@link IncomingMessage}.
586
+ *
587
+ * During the `'response'` event, one can add listeners to the
588
+ * response object; particularly to listen for the `'data'` event.
589
+ *
590
+ * If no `'response'` handler is added, then the response will be
591
+ * entirely discarded. However, if a `'response'` event handler is added,
592
+ * then the data from the response object **must** be consumed, either by
593
+ * calling `response.read()` whenever there is a `'readable'` event, or
594
+ * by adding a `'data'` handler, or by calling the `.resume()` method.
595
+ * Until the data is consumed, the `'end'` event will not fire. Also, until
596
+ * the data is read it will consume memory that can eventually lead to a
597
+ * 'process out of memory' error.
598
+ *
599
+ * For backward compatibility, `res` will only emit `'error'` if there is an`'error'` listener registered.
600
+ *
601
+ * Node.js does not check whether Content-Length and the length of the
602
+ * body which has been transmitted are equal or not.
603
+ * @since v0.1.17
604
+ */
605
+ class ClientRequest extends OutgoingMessage {
606
+ /**
607
+ * The `request.aborted` property will be `true` if the request has
608
+ * been aborted.
609
+ * @since v0.11.14
610
+ */
611
+ aborted: boolean;
612
+ /**
613
+ * The request host.
614
+ * @since v14.5.0, v12.19.0
615
+ */
616
+ host: string;
617
+ /**
618
+ * The request protocol.
619
+ * @since v14.5.0, v12.19.0
620
+ */
621
+ protocol: string;
622
+ constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void);
623
+ /**
624
+ * The request method.
625
+ * @since v0.1.97
626
+ */
627
+ method: string;
628
+ /**
629
+ * The request path.
630
+ * @since v0.4.0
631
+ */
632
+ path: string;
633
+ /**
634
+ * Marks the request as aborting. Calling this will cause remaining data
635
+ * in the response to be dropped and the socket to be destroyed.
636
+ * @since v0.3.8
637
+ * @deprecated Since v14.1.0,v13.14.0 - Use `destroy` instead.
638
+ */
639
+ abort(): void;
640
+ onSocket(socket: Socket): void;
641
+ /**
642
+ * Once a socket is assigned to this request and is connected `socket.setTimeout()` will be called.
643
+ * @since v0.5.9
644
+ * @param timeout Milliseconds before a request times out.
645
+ * @param callback Optional function to be called when a timeout occurs. Same as binding to the `'timeout'` event.
646
+ */
647
+ setTimeout(timeout: number, callback?: () => void): this;
648
+ /**
649
+ * Once a socket is assigned to this request and is connected `socket.setNoDelay()` will be called.
650
+ * @since v0.5.9
651
+ */
652
+ setNoDelay(noDelay?: boolean): void;
653
+ /**
654
+ * Once a socket is assigned to this request and is connected `socket.setKeepAlive()` will be called.
655
+ * @since v0.5.9
656
+ */
657
+ setSocketKeepAlive(enable?: boolean, initialDelay?: number): void;
658
+ /**
659
+ * Returns an array containing the unique names of the current outgoing raw
660
+ * headers. Header names are returned with their exact casing being set.
661
+ *
662
+ * ```js
663
+ * request.setHeader('Foo', 'bar');
664
+ * request.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);
665
+ *
666
+ * const headerNames = request.getRawHeaderNames();
667
+ * // headerNames === ['Foo', 'Set-Cookie']
668
+ * ```
669
+ * @since v15.13.0
670
+ */
671
+ getRawHeaderNames(): string[];
672
+ addListener(event: 'abort', listener: () => void): this;
673
+ addListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
674
+ addListener(event: 'continue', listener: () => void): this;
675
+ addListener(event: 'information', listener: (info: InformationEvent) => void): this;
676
+ addListener(event: 'response', listener: (response: IncomingMessage) => void): this;
677
+ addListener(event: 'socket', listener: (socket: Socket) => void): this;
678
+ addListener(event: 'timeout', listener: () => void): this;
679
+ addListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
680
+ addListener(event: 'close', listener: () => void): this;
681
+ addListener(event: 'drain', listener: () => void): this;
682
+ addListener(event: 'error', listener: (err: Error) => void): this;
683
+ addListener(event: 'finish', listener: () => void): this;
684
+ addListener(event: 'pipe', listener: (src: stream.Readable) => void): this;
685
+ addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this;
686
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
687
+ on(event: 'abort', listener: () => void): this;
688
+ on(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
689
+ on(event: 'continue', listener: () => void): this;
690
+ on(event: 'information', listener: (info: InformationEvent) => void): this;
691
+ on(event: 'response', listener: (response: IncomingMessage) => void): this;
692
+ on(event: 'socket', listener: (socket: Socket) => void): this;
693
+ on(event: 'timeout', listener: () => void): this;
694
+ on(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
695
+ on(event: 'close', listener: () => void): this;
696
+ on(event: 'drain', listener: () => void): this;
697
+ on(event: 'error', listener: (err: Error) => void): this;
698
+ on(event: 'finish', listener: () => void): this;
699
+ on(event: 'pipe', listener: (src: stream.Readable) => void): this;
700
+ on(event: 'unpipe', listener: (src: stream.Readable) => void): this;
701
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
702
+ once(event: 'abort', listener: () => void): this;
703
+ once(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
704
+ once(event: 'continue', listener: () => void): this;
705
+ once(event: 'information', listener: (info: InformationEvent) => void): this;
706
+ once(event: 'response', listener: (response: IncomingMessage) => void): this;
707
+ once(event: 'socket', listener: (socket: Socket) => void): this;
708
+ once(event: 'timeout', listener: () => void): this;
709
+ once(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
710
+ once(event: 'close', listener: () => void): this;
711
+ once(event: 'drain', listener: () => void): this;
712
+ once(event: 'error', listener: (err: Error) => void): this;
713
+ once(event: 'finish', listener: () => void): this;
714
+ once(event: 'pipe', listener: (src: stream.Readable) => void): this;
715
+ once(event: 'unpipe', listener: (src: stream.Readable) => void): this;
716
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
717
+ prependListener(event: 'abort', listener: () => void): this;
718
+ prependListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
719
+ prependListener(event: 'continue', listener: () => void): this;
720
+ prependListener(event: 'information', listener: (info: InformationEvent) => void): this;
721
+ prependListener(event: 'response', listener: (response: IncomingMessage) => void): this;
722
+ prependListener(event: 'socket', listener: (socket: Socket) => void): this;
723
+ prependListener(event: 'timeout', listener: () => void): this;
724
+ prependListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
725
+ prependListener(event: 'close', listener: () => void): this;
726
+ prependListener(event: 'drain', listener: () => void): this;
727
+ prependListener(event: 'error', listener: (err: Error) => void): this;
728
+ prependListener(event: 'finish', listener: () => void): this;
729
+ prependListener(event: 'pipe', listener: (src: stream.Readable) => void): this;
730
+ prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this;
731
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
732
+ prependOnceListener(event: 'abort', listener: () => void): this;
733
+ prependOnceListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
734
+ prependOnceListener(event: 'continue', listener: () => void): this;
735
+ prependOnceListener(event: 'information', listener: (info: InformationEvent) => void): this;
736
+ prependOnceListener(event: 'response', listener: (response: IncomingMessage) => void): this;
737
+ prependOnceListener(event: 'socket', listener: (socket: Socket) => void): this;
738
+ prependOnceListener(event: 'timeout', listener: () => void): this;
739
+ prependOnceListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
740
+ prependOnceListener(event: 'close', listener: () => void): this;
741
+ prependOnceListener(event: 'drain', listener: () => void): this;
742
+ prependOnceListener(event: 'error', listener: (err: Error) => void): this;
743
+ prependOnceListener(event: 'finish', listener: () => void): this;
744
+ prependOnceListener(event: 'pipe', listener: (src: stream.Readable) => void): this;
745
+ prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this;
746
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
747
+ }
748
+ /**
749
+ * 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
750
+ * access response
751
+ * status, headers and data.
752
+ *
753
+ * Different from its `socket` value which is a subclass of `stream.Duplex`, the`IncomingMessage` itself extends `stream.Readable` and is created separately to
754
+ * parse and emit the incoming HTTP headers and payload, as the underlying socket
755
+ * may be reused multiple times in case of keep-alive.
756
+ * @since v0.1.17
757
+ */
758
+ class IncomingMessage extends stream.Readable {
759
+ constructor(socket: Socket);
760
+ /**
761
+ * The `message.aborted` property will be `true` if the request has
762
+ * been aborted.
763
+ * @since v10.1.0
764
+ */
765
+ aborted: boolean;
766
+ /**
767
+ * In case of server request, the HTTP version sent by the client. In the case of
768
+ * client response, the HTTP version of the connected-to server.
769
+ * Probably either `'1.1'` or `'1.0'`.
770
+ *
771
+ * Also `message.httpVersionMajor` is the first integer and`message.httpVersionMinor` is the second.
772
+ * @since v0.1.1
773
+ */
774
+ httpVersion: string;
775
+ httpVersionMajor: number;
776
+ httpVersionMinor: number;
777
+ /**
778
+ * The `message.complete` property will be `true` if a complete HTTP message has
779
+ * been received and successfully parsed.
780
+ *
781
+ * This property is particularly useful as a means of determining if a client or
782
+ * server fully transmitted a message before a connection was terminated:
783
+ *
784
+ * ```js
785
+ * const req = http.request({
786
+ * host: '127.0.0.1',
787
+ * port: 8080,
788
+ * method: 'POST'
789
+ * }, (res) => {
790
+ * res.resume();
791
+ * res.on('end', () => {
792
+ * if (!res.complete)
793
+ * console.error(
794
+ * 'The connection was terminated while the message was still being sent');
795
+ * });
796
+ * });
797
+ * ```
798
+ * @since v0.3.0
799
+ */
800
+ complete: boolean;
801
+ /**
802
+ * Alias for `message.socket`.
803
+ * @since v0.1.90
804
+ * @deprecated Since v16.0.0 - Use `socket`.
805
+ */
806
+ connection: Socket;
807
+ /**
808
+ * The `net.Socket` object associated with the connection.
809
+ *
810
+ * With HTTPS support, use `request.socket.getPeerCertificate()` to obtain the
811
+ * client's authentication details.
812
+ *
813
+ * This property is guaranteed to be an instance of the `net.Socket` class,
814
+ * a subclass of `stream.Duplex`, unless the user specified a socket
815
+ * type other than `net.Socket`.
816
+ * @since v0.3.0
817
+ */
818
+ socket: Socket;
819
+ /**
820
+ * The request/response headers object.
821
+ *
822
+ * Key-value pairs of header names and values. Header names are lower-cased.
823
+ *
824
+ * ```js
825
+ * // Prints something like:
826
+ * //
827
+ * // { 'user-agent': 'curl/7.22.0',
828
+ * // host: '127.0.0.1:8000',
829
+ * // accept: '*' }
830
+ * console.log(request.headers);
831
+ * ```
832
+ *
833
+ * Duplicates in raw headers are handled in the following ways, depending on the
834
+ * header name:
835
+ *
836
+ * * Duplicates of `age`, `authorization`, `content-length`, `content-type`,`etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`,`last-modified`, `location`,
837
+ * `max-forwards`, `proxy-authorization`, `referer`,`retry-after`, `server`, or `user-agent` are discarded.
838
+ * * `set-cookie` is always an array. Duplicates are added to the array.
839
+ * * For duplicate `cookie` headers, the values are joined together with '; '.
840
+ * * For all other headers, the values are joined together with ', '.
841
+ * @since v0.1.5
842
+ */
843
+ headers: IncomingHttpHeaders;
844
+ /**
845
+ * The raw request/response headers list exactly as they were received.
846
+ *
847
+ * The keys and values are in the same list. It is _not_ a
848
+ * list of tuples. So, the even-numbered offsets are key values, and the
849
+ * odd-numbered offsets are the associated values.
850
+ *
851
+ * Header names are not lowercased, and duplicates are not merged.
852
+ *
853
+ * ```js
854
+ * // Prints something like:
855
+ * //
856
+ * // [ 'user-agent',
857
+ * // 'this is invalid because there can be only one',
858
+ * // 'User-Agent',
859
+ * // 'curl/7.22.0',
860
+ * // 'Host',
861
+ * // '127.0.0.1:8000',
862
+ * // 'ACCEPT',
863
+ * // '*' ]
864
+ * console.log(request.rawHeaders);
865
+ * ```
866
+ * @since v0.11.6
867
+ */
868
+ rawHeaders: string[];
869
+ /**
870
+ * The request/response trailers object. Only populated at the `'end'` event.
871
+ * @since v0.3.0
872
+ */
873
+ trailers: NodeJS.Dict<string>;
874
+ /**
875
+ * The raw request/response trailer keys and values exactly as they were
876
+ * received. Only populated at the `'end'` event.
877
+ * @since v0.11.6
878
+ */
879
+ rawTrailers: string[];
880
+ /**
881
+ * Calls `message.socket.setTimeout(msecs, callback)`.
882
+ * @since v0.5.9
883
+ */
884
+ setTimeout(msecs: number, callback?: () => void): this;
885
+ /**
886
+ * **Only valid for request obtained from {@link Server}.**
887
+ *
888
+ * The request method as a string. Read only. Examples: `'GET'`, `'DELETE'`.
889
+ * @since v0.1.1
890
+ */
891
+ method?: string | undefined;
892
+ /**
893
+ * **Only valid for request obtained from {@link Server}.**
894
+ *
895
+ * Request URL string. This contains only the URL that is present in the actual
896
+ * HTTP request. Take the following request:
897
+ *
898
+ * ```http
899
+ * GET /status?name=ryan HTTP/1.1
900
+ * Accept: text/plain
901
+ * ```
902
+ *
903
+ * To parse the URL into its parts:
904
+ *
905
+ * ```js
906
+ * new URL(request.url, `http://${request.headers.host}`);
907
+ * ```
908
+ *
909
+ * When `request.url` is `'/status?name=ryan'` and`request.headers.host` is `'localhost:3000'`:
910
+ *
911
+ * ```console
912
+ * $ node
913
+ * > new URL(request.url, `http://${request.headers.host}`)
914
+ * URL {
915
+ * href: 'http://localhost:3000/status?name=ryan',
916
+ * origin: 'http://localhost:3000',
917
+ * protocol: 'http:',
918
+ * username: '',
919
+ * password: '',
920
+ * host: 'localhost:3000',
921
+ * hostname: 'localhost',
922
+ * port: '3000',
923
+ * pathname: '/status',
924
+ * search: '?name=ryan',
925
+ * searchParams: URLSearchParams { 'name' => 'ryan' },
926
+ * hash: ''
927
+ * }
928
+ * ```
929
+ * @since v0.1.90
930
+ */
931
+ url?: string | undefined;
932
+ /**
933
+ * **Only valid for response obtained from {@link ClientRequest}.**
934
+ *
935
+ * The 3-digit HTTP response status code. E.G. `404`.
936
+ * @since v0.1.1
937
+ */
938
+ statusCode?: number | undefined;
939
+ /**
940
+ * **Only valid for response obtained from {@link ClientRequest}.**
941
+ *
942
+ * The HTTP response status message (reason phrase). E.G. `OK` or `Internal Server Error`.
943
+ * @since v0.11.10
944
+ */
945
+ statusMessage?: string | undefined;
946
+ /**
947
+ * 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
948
+ * as an argument to any listeners on the event.
949
+ * @since v0.3.0
950
+ */
951
+ destroy(error?: Error): void;
952
+ }
953
+ interface AgentOptions {
954
+ /**
955
+ * Keep sockets around in a pool to be used by other requests in the future. Default = false
956
+ */
957
+ keepAlive?: boolean | undefined;
958
+ /**
959
+ * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000.
960
+ * Only relevant if keepAlive is set to true.
961
+ */
962
+ keepAliveMsecs?: number | undefined;
963
+ /**
964
+ * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
965
+ */
966
+ maxSockets?: number | undefined;
967
+ /**
968
+ * Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity.
969
+ */
970
+ maxTotalSockets?: number | undefined;
971
+ /**
972
+ * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256.
973
+ */
974
+ maxFreeSockets?: number | undefined;
975
+ /**
976
+ * Socket timeout in milliseconds. This will set the timeout after the socket is connected.
977
+ */
978
+ timeout?: number | undefined;
979
+ /**
980
+ * Scheduling strategy to apply when picking the next free socket to use.
981
+ * @default `lifo`
982
+ */
983
+ scheduling?: 'fifo' | 'lifo' | undefined;
984
+ }
985
+ /**
986
+ * An `Agent` is responsible for managing connection persistence
987
+ * and reuse for HTTP clients. It maintains a queue of pending requests
988
+ * for a given host and port, reusing a single socket connection for each
989
+ * until the queue is empty, at which time the socket is either destroyed
990
+ * or put into a pool where it is kept to be used again for requests to the
991
+ * same host and port. Whether it is destroyed or pooled depends on the`keepAlive` `option`.
992
+ *
993
+ * Pooled connections have TCP Keep-Alive enabled for them, but servers may
994
+ * still close idle connections, in which case they will be removed from the
995
+ * pool and a new connection will be made when a new HTTP request is made for
996
+ * that host and port. Servers may also refuse to allow multiple requests
997
+ * over the same connection, in which case the connection will have to be
998
+ * remade for every request and cannot be pooled. The `Agent` will still make
999
+ * the requests to that server, but each one will occur over a new connection.
1000
+ *
1001
+ * When a connection is closed by the client or the server, it is removed
1002
+ * from the pool. Any unused sockets in the pool will be unrefed so as not
1003
+ * to keep the Node.js process running when there are no outstanding requests.
1004
+ * (see `socket.unref()`).
1005
+ *
1006
+ * It is good practice, to `destroy()` an `Agent` instance when it is no
1007
+ * longer in use, because unused sockets consume OS resources.
1008
+ *
1009
+ * Sockets are removed from an agent when the socket emits either
1010
+ * a `'close'` event or an `'agentRemove'` event. When intending to keep one
1011
+ * HTTP request open for a long time without keeping it in the agent, something
1012
+ * like the following may be done:
1013
+ *
1014
+ * ```js
1015
+ * http.get(options, (res) => {
1016
+ * // Do stuff
1017
+ * }).on('socket', (socket) => {
1018
+ * socket.emit('agentRemove');
1019
+ * });
1020
+ * ```
1021
+ *
1022
+ * 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
1023
+ * will be used
1024
+ * for the client connection.
1025
+ *
1026
+ * `agent:false`:
1027
+ *
1028
+ * ```js
1029
+ * http.get({
1030
+ * hostname: 'localhost',
1031
+ * port: 80,
1032
+ * path: '/',
1033
+ * agent: false // Create a new agent just for this one request
1034
+ * }, (res) => {
1035
+ * // Do stuff with response
1036
+ * });
1037
+ * ```
1038
+ * @since v0.3.4
1039
+ */
1040
+ class Agent {
1041
+ /**
1042
+ * By default set to 256\. For agents with `keepAlive` enabled, this
1043
+ * sets the maximum number of sockets that will be left open in the free
1044
+ * state.
1045
+ * @since v0.11.7
1046
+ */
1047
+ maxFreeSockets: number;
1048
+ /**
1049
+ * By default set to `Infinity`. Determines how many concurrent sockets the agent
1050
+ * can have open per origin. Origin is the returned value of `agent.getName()`.
1051
+ * @since v0.3.6
1052
+ */
1053
+ maxSockets: number;
1054
+ /**
1055
+ * By default set to `Infinity`. Determines how many concurrent sockets the agent
1056
+ * can have open. Unlike `maxSockets`, this parameter applies across all origins.
1057
+ * @since v14.5.0, v12.19.0
1058
+ */
1059
+ maxTotalSockets: number;
1060
+ /**
1061
+ * An object which contains arrays of sockets currently awaiting use by
1062
+ * the agent when `keepAlive` is enabled. Do not modify.
1063
+ *
1064
+ * Sockets in the `freeSockets` list will be automatically destroyed and
1065
+ * removed from the array on `'timeout'`.
1066
+ * @since v0.11.4
1067
+ */
1068
+ readonly freeSockets: NodeJS.ReadOnlyDict<Socket[]>;
1069
+ /**
1070
+ * An object which contains arrays of sockets currently in use by the
1071
+ * agent. Do not modify.
1072
+ * @since v0.3.6
1073
+ */
1074
+ readonly sockets: NodeJS.ReadOnlyDict<Socket[]>;
1075
+ /**
1076
+ * An object which contains queues of requests that have not yet been assigned to
1077
+ * sockets. Do not modify.
1078
+ * @since v0.5.9
1079
+ */
1080
+ readonly requests: NodeJS.ReadOnlyDict<IncomingMessage[]>;
1081
+ constructor(opts?: AgentOptions);
1082
+ /**
1083
+ * Destroy any sockets that are currently in use by the agent.
1084
+ *
1085
+ * It is usually not necessary to do this. However, if using an
1086
+ * agent with `keepAlive` enabled, then it is best to explicitly shut down
1087
+ * the agent when it is no longer needed. Otherwise,
1088
+ * sockets might stay open for quite a long time before the server
1089
+ * terminates them.
1090
+ * @since v0.11.4
1091
+ */
1092
+ destroy(): void;
1093
+ }
1094
+ const METHODS: string[];
1095
+ const STATUS_CODES: {
1096
+ [errorCode: number]: string | undefined;
1097
+ [errorCode: string]: string | undefined;
1098
+ };
1099
+ /**
1100
+ * Returns a new instance of {@link Server}.
1101
+ *
1102
+ * The `requestListener` is a function which is automatically
1103
+ * added to the `'request'` event.
1104
+ * @since v0.1.13
1105
+ */
1106
+ function createServer(requestListener?: RequestListener): Server;
1107
+ function createServer(options: ServerOptions, requestListener?: RequestListener): Server;
1108
+ // although RequestOptions are passed as ClientRequestArgs to ClientRequest directly,
1109
+ // create interface RequestOptions would make the naming more clear to developers
1110
+ interface RequestOptions extends ClientRequestArgs {}
1111
+ /**
1112
+ * Node.js maintains several connections per server to make HTTP requests.
1113
+ * This function allows one to transparently issue requests.
1114
+ *
1115
+ * `url` can be a string or a `URL` object. If `url` is a
1116
+ * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
1117
+ *
1118
+ * If both `url` and `options` are specified, the objects are merged, with the`options` properties taking precedence.
1119
+ *
1120
+ * The optional `callback` parameter will be added as a one-time listener for
1121
+ * the `'response'` event.
1122
+ *
1123
+ * `http.request()` returns an instance of the {@link ClientRequest} class. The `ClientRequest` instance is a writable stream. If one needs to
1124
+ * upload a file with a POST request, then write to the `ClientRequest` object.
1125
+ *
1126
+ * ```js
1127
+ * const http = require('http');
1128
+ *
1129
+ * const postData = JSON.stringify({
1130
+ * 'msg': 'Hello World!'
1131
+ * });
1132
+ *
1133
+ * const options = {
1134
+ * hostname: 'www.google.com',
1135
+ * port: 80,
1136
+ * path: '/upload',
1137
+ * method: 'POST',
1138
+ * headers: {
1139
+ * 'Content-Type': 'application/json',
1140
+ * 'Content-Length': Buffer.byteLength(postData)
1141
+ * }
1142
+ * };
1143
+ *
1144
+ * const req = http.request(options, (res) => {
1145
+ * console.log(`STATUS: ${res.statusCode}`);
1146
+ * console.log(`HEADERS: ${JSON.stringify(res.headers)}`);
1147
+ * res.setEncoding('utf8');
1148
+ * res.on('data', (chunk) => {
1149
+ * console.log(`BODY: ${chunk}`);
1150
+ * });
1151
+ * res.on('end', () => {
1152
+ * console.log('No more data in response.');
1153
+ * });
1154
+ * });
1155
+ *
1156
+ * req.on('error', (e) => {
1157
+ * console.error(`problem with request: ${e.message}`);
1158
+ * });
1159
+ *
1160
+ * // Write data to request body
1161
+ * req.write(postData);
1162
+ * req.end();
1163
+ * ```
1164
+ *
1165
+ * In the example `req.end()` was called. With `http.request()` one
1166
+ * must always call `req.end()` to signify the end of the request -
1167
+ * even if there is no data being written to the request body.
1168
+ *
1169
+ * If any error is encountered during the request (be that with DNS resolution,
1170
+ * TCP level errors, or actual HTTP parse errors) an `'error'` event is emitted
1171
+ * on the returned request object. As with all `'error'` events, if no listeners
1172
+ * are registered the error will be thrown.
1173
+ *
1174
+ * There are a few special headers that should be noted.
1175
+ *
1176
+ * * Sending a 'Connection: keep-alive' will notify Node.js that the connection to
1177
+ * the server should be persisted until the next request.
1178
+ * * Sending a 'Content-Length' header will disable the default chunked encoding.
1179
+ * * Sending an 'Expect' header will immediately send the request headers.
1180
+ * Usually, when sending 'Expect: 100-continue', both a timeout and a listener
1181
+ * for the `'continue'` event should be set. See RFC 2616 Section 8.2.3 for more
1182
+ * information.
1183
+ * * Sending an Authorization header will override using the `auth` option
1184
+ * to compute basic authentication.
1185
+ *
1186
+ * Example using a `URL` as `options`:
1187
+ *
1188
+ * ```js
1189
+ * const options = new URL('http://abc:xyz@example.com');
1190
+ *
1191
+ * const req = http.request(options, (res) => {
1192
+ * // ...
1193
+ * });
1194
+ * ```
1195
+ *
1196
+ * In a successful request, the following events will be emitted in the following
1197
+ * order:
1198
+ *
1199
+ * * `'socket'`
1200
+ * * `'response'`
1201
+ * * `'data'` any number of times, on the `res` object
1202
+ * (`'data'` will not be emitted at all if the response body is empty, for
1203
+ * instance, in most redirects)
1204
+ * * `'end'` on the `res` object
1205
+ * * `'close'`
1206
+ *
1207
+ * In the case of a connection error, the following events will be emitted:
1208
+ *
1209
+ * * `'socket'`
1210
+ * * `'error'`
1211
+ * * `'close'`
1212
+ *
1213
+ * In the case of a premature connection close before the response is received,
1214
+ * the following events will be emitted in the following order:
1215
+ *
1216
+ * * `'socket'`
1217
+ * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`
1218
+ * * `'close'`
1219
+ *
1220
+ * In the case of a premature connection close after the response is received,
1221
+ * the following events will be emitted in the following order:
1222
+ *
1223
+ * * `'socket'`
1224
+ * * `'response'`
1225
+ * * `'data'` any number of times, on the `res` object
1226
+ * * (connection closed here)
1227
+ * * `'aborted'` on the `res` object
1228
+ * * `'error'` on the `res` object with an error with message`'Error: aborted'` and code `'ECONNRESET'`.
1229
+ * * `'close'`
1230
+ * * `'close'` on the `res` object
1231
+ *
1232
+ * If `req.destroy()` is called before a socket is assigned, the following
1233
+ * events will be emitted in the following order:
1234
+ *
1235
+ * * (`req.destroy()` called here)
1236
+ * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`
1237
+ * * `'close'`
1238
+ *
1239
+ * If `req.destroy()` is called before the connection succeeds, the following
1240
+ * events will be emitted in the following order:
1241
+ *
1242
+ * * `'socket'`
1243
+ * * (`req.destroy()` called here)
1244
+ * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`
1245
+ * * `'close'`
1246
+ *
1247
+ * If `req.destroy()` is called after the response is received, the following
1248
+ * events will be emitted in the following order:
1249
+ *
1250
+ * * `'socket'`
1251
+ * * `'response'`
1252
+ * * `'data'` any number of times, on the `res` object
1253
+ * * (`req.destroy()` called here)
1254
+ * * `'aborted'` on the `res` object
1255
+ * * `'error'` on the `res` object with an error with message`'Error: aborted'` and code `'ECONNRESET'`.
1256
+ * * `'close'`
1257
+ * * `'close'` on the `res` object
1258
+ *
1259
+ * If `req.abort()` is called before a socket is assigned, the following
1260
+ * events will be emitted in the following order:
1261
+ *
1262
+ * * (`req.abort()` called here)
1263
+ * * `'abort'`
1264
+ * * `'close'`
1265
+ *
1266
+ * If `req.abort()` is called before the connection succeeds, the following
1267
+ * events will be emitted in the following order:
1268
+ *
1269
+ * * `'socket'`
1270
+ * * (`req.abort()` called here)
1271
+ * * `'abort'`
1272
+ * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`
1273
+ * * `'close'`
1274
+ *
1275
+ * If `req.abort()` is called after the response is received, the following
1276
+ * events will be emitted in the following order:
1277
+ *
1278
+ * * `'socket'`
1279
+ * * `'response'`
1280
+ * * `'data'` any number of times, on the `res` object
1281
+ * * (`req.abort()` called here)
1282
+ * * `'abort'`
1283
+ * * `'aborted'` on the `res` object
1284
+ * * `'error'` on the `res` object with an error with message`'Error: aborted'` and code `'ECONNRESET'`.
1285
+ * * `'close'`
1286
+ * * `'close'` on the `res` object
1287
+ *
1288
+ * Setting the `timeout` option or using the `setTimeout()` function will
1289
+ * not abort the request or do anything besides add a `'timeout'` event.
1290
+ *
1291
+ * Passing an `AbortSignal` and then calling `abort` on the corresponding`AbortController` will behave the same way as calling `.destroy()` on the
1292
+ * request itself.
1293
+ * @since v0.3.6
1294
+ */
1295
+ function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
1296
+ function request(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
1297
+ /**
1298
+ * Since most requests are GET requests without bodies, Node.js provides this
1299
+ * convenience method. The only difference between this method and {@link request} is that it sets the method to GET and calls `req.end()`automatically. The callback must take care to consume the
1300
+ * response
1301
+ * data for reasons stated in {@link ClientRequest} section.
1302
+ *
1303
+ * The `callback` is invoked with a single argument that is an instance of {@link IncomingMessage}.
1304
+ *
1305
+ * JSON fetching example:
1306
+ *
1307
+ * ```js
1308
+ * http.get('http://localhost:8000/', (res) => {
1309
+ * const { statusCode } = res;
1310
+ * const contentType = res.headers['content-type'];
1311
+ *
1312
+ * let error;
1313
+ * // Any 2xx status code signals a successful response but
1314
+ * // here we're only checking for 200.
1315
+ * if (statusCode !== 200) {
1316
+ * error = new Error('Request Failed.\n' +
1317
+ * `Status Code: ${statusCode}`);
1318
+ * } else if (!/^application\/json/.test(contentType)) {
1319
+ * error = new Error('Invalid content-type.\n' +
1320
+ * `Expected application/json but received ${contentType}`);
1321
+ * }
1322
+ * if (error) {
1323
+ * console.error(error.message);
1324
+ * // Consume response data to free up memory
1325
+ * res.resume();
1326
+ * return;
1327
+ * }
1328
+ *
1329
+ * res.setEncoding('utf8');
1330
+ * let rawData = '';
1331
+ * res.on('data', (chunk) => { rawData += chunk; });
1332
+ * res.on('end', () => {
1333
+ * try {
1334
+ * const parsedData = JSON.parse(rawData);
1335
+ * console.log(parsedData);
1336
+ * } catch (e) {
1337
+ * console.error(e.message);
1338
+ * }
1339
+ * });
1340
+ * }).on('error', (e) => {
1341
+ * console.error(`Got error: ${e.message}`);
1342
+ * });
1343
+ *
1344
+ * // Create a local server to receive data from
1345
+ * const server = http.createServer((req, res) => {
1346
+ * res.writeHead(200, { 'Content-Type': 'application/json' });
1347
+ * res.end(JSON.stringify({
1348
+ * data: 'Hello World!'
1349
+ * }));
1350
+ * });
1351
+ *
1352
+ * server.listen(8000);
1353
+ * ```
1354
+ * @since v0.3.6
1355
+ * @param options Accepts the same `options` as {@link request}, with the `method` always set to `GET`. Properties that are inherited from the prototype are ignored.
1356
+ */
1357
+ function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
1358
+ function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
1359
+ let globalAgent: Agent;
1360
+ /**
1361
+ * Read-only property specifying the maximum allowed size of HTTP headers in bytes.
1362
+ * Defaults to 16KB. Configurable using the `--max-http-header-size` CLI option.
1363
+ */
1364
+ const maxHeaderSize: number;
1365
+ }
1366
+ declare module 'node:http' {
1367
+ export * from 'http';
1368
+ }