projen 0.71.51 → 0.71.53

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 (313) hide show
  1. package/.jsii +3 -3
  2. package/lib/awscdk/auto-discover.js +5 -5
  3. package/lib/awscdk/awscdk-app-java.js +1 -1
  4. package/lib/awscdk/awscdk-app-py.js +1 -1
  5. package/lib/awscdk/awscdk-app-ts.js +1 -1
  6. package/lib/awscdk/awscdk-construct.js +2 -2
  7. package/lib/awscdk/awscdk-deps-java.js +1 -1
  8. package/lib/awscdk/awscdk-deps-js.js +1 -1
  9. package/lib/awscdk/awscdk-deps-py.js +1 -1
  10. package/lib/awscdk/awscdk-deps.js +1 -1
  11. package/lib/awscdk/cdk-config.js +1 -1
  12. package/lib/awscdk/cdk-tasks.js +1 -1
  13. package/lib/awscdk/integration-test.js +1 -1
  14. package/lib/awscdk/lambda-extension.js +1 -1
  15. package/lib/awscdk/lambda-function.js +2 -2
  16. package/lib/build/build-workflow.js +1 -1
  17. package/lib/cdk/auto-discover-base.js +2 -2
  18. package/lib/cdk/construct-lib.js +1 -1
  19. package/lib/cdk/integration-test-base.js +1 -1
  20. package/lib/cdk/jsii-docgen.js +1 -1
  21. package/lib/cdk/jsii-project.js +1 -1
  22. package/lib/cdk8s/auto-discover.js +2 -2
  23. package/lib/cdk8s/cdk8s-app-py.js +1 -1
  24. package/lib/cdk8s/cdk8s-app-ts.js +1 -1
  25. package/lib/cdk8s/cdk8s-construct.js +1 -1
  26. package/lib/cdk8s/cdk8s-deps-py.js +1 -1
  27. package/lib/cdk8s/cdk8s-deps.js +1 -1
  28. package/lib/cdk8s/integration-test.js +1 -1
  29. package/lib/cdktf/cdktf-construct.js +1 -1
  30. package/lib/circleci/circleci.js +1 -1
  31. package/lib/component.js +1 -1
  32. package/lib/dependencies.js +1 -1
  33. package/lib/dev-env.js +1 -1
  34. package/lib/docker-compose/docker-compose-service.js +1 -1
  35. package/lib/docker-compose/docker-compose.js +1 -1
  36. package/lib/file.js +1 -1
  37. package/lib/gitattributes.js +1 -1
  38. package/lib/github/actions-provider.js +1 -1
  39. package/lib/github/auto-approve.js +1 -1
  40. package/lib/github/auto-merge.js +1 -1
  41. package/lib/github/dependabot.js +1 -1
  42. package/lib/github/github-credentials.js +1 -1
  43. package/lib/github/github-project.js +1 -1
  44. package/lib/github/github.js +1 -1
  45. package/lib/github/mergify.js +1 -1
  46. package/lib/github/pr-template.js +1 -1
  47. package/lib/github/pull-request-lint.js +1 -1
  48. package/lib/github/stale.js +1 -1
  49. package/lib/github/task-workflow.js +1 -1
  50. package/lib/github/workflow-actions.js +1 -1
  51. package/lib/github/workflow-jobs.js +1 -1
  52. package/lib/github/workflows.js +1 -1
  53. package/lib/gitlab/configuration.js +1 -1
  54. package/lib/gitlab/gitlab-configuration.js +1 -1
  55. package/lib/gitlab/nested-configuration.js +1 -1
  56. package/lib/gitpod.js +1 -1
  57. package/lib/ignore-file.js +1 -1
  58. package/lib/ini.js +1 -1
  59. package/lib/java/java-project.js +1 -1
  60. package/lib/java/junit.js +1 -1
  61. package/lib/java/maven-compile.js +1 -1
  62. package/lib/java/maven-packaging.js +1 -1
  63. package/lib/java/maven-sample.js +1 -1
  64. package/lib/java/pom.js +1 -1
  65. package/lib/java/projenrc.js +1 -1
  66. package/lib/javascript/bundler.js +1 -1
  67. package/lib/javascript/eslint.js +1 -1
  68. package/lib/javascript/jest.js +4 -4
  69. package/lib/javascript/node-package.js +1 -1
  70. package/lib/javascript/node-project.js +1 -1
  71. package/lib/javascript/npm-config.js +1 -1
  72. package/lib/javascript/prettier.js +1 -1
  73. package/lib/javascript/projenrc.js +1 -1
  74. package/lib/javascript/typescript-config.js +2 -2
  75. package/lib/javascript/upgrade-dependencies.js +2 -2
  76. package/lib/json-patch.js +1 -1
  77. package/lib/json.js +1 -1
  78. package/lib/license.js +1 -1
  79. package/lib/logger.js +1 -1
  80. package/lib/makefile.js +1 -1
  81. package/lib/object-file.js +1 -1
  82. package/lib/project-build.js +1 -1
  83. package/lib/project.js +1 -1
  84. package/lib/projects.js +1 -1
  85. package/lib/projenrc-json.js +2 -2
  86. package/lib/projenrc.js +1 -1
  87. package/lib/python/pip.js +1 -1
  88. package/lib/python/poetry.js +2 -2
  89. package/lib/python/projenrc.js +1 -1
  90. package/lib/python/pytest-sample.js +1 -1
  91. package/lib/python/pytest.js +1 -1
  92. package/lib/python/python-project.js +1 -1
  93. package/lib/python/python-sample.js +1 -1
  94. package/lib/python/requirements-file.js +1 -1
  95. package/lib/python/setuppy.js +1 -1
  96. package/lib/python/setuptools.js +1 -1
  97. package/lib/python/venv.js +1 -1
  98. package/lib/readme.js +1 -1
  99. package/lib/release/publisher.js +1 -1
  100. package/lib/release/release-trigger.js +1 -1
  101. package/lib/release/release.js +1 -1
  102. package/lib/renovatebot.js +1 -1
  103. package/lib/sample-file.js +2 -2
  104. package/lib/semver.js +1 -1
  105. package/lib/source-code.js +1 -1
  106. package/lib/task-runtime.js +1 -1
  107. package/lib/task.js +1 -1
  108. package/lib/tasks.js +1 -1
  109. package/lib/testing.js +1 -1
  110. package/lib/textfile.js +1 -1
  111. package/lib/toml.js +1 -1
  112. package/lib/typescript/projenrc-ts.js +1 -1
  113. package/lib/typescript/projenrc.js +1 -1
  114. package/lib/typescript/typescript-typedoc.js +1 -1
  115. package/lib/typescript/typescript.js +3 -3
  116. package/lib/version.js +1 -1
  117. package/lib/vscode/devcontainer.js +1 -1
  118. package/lib/vscode/extensions.js +1 -1
  119. package/lib/vscode/launch-config.js +1 -1
  120. package/lib/vscode/settings.js +1 -1
  121. package/lib/vscode/vscode.js +1 -1
  122. package/lib/web/next.js +3 -3
  123. package/lib/web/postcss.js +1 -1
  124. package/lib/web/react.js +4 -4
  125. package/lib/web/tailwind.js +1 -1
  126. package/lib/xmlfile.js +1 -1
  127. package/lib/yaml.js +1 -1
  128. package/node_modules/@oozcitak/dom/LICENSE +21 -21
  129. package/node_modules/@oozcitak/dom/README.md +32 -32
  130. package/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.d.ts +12 -0
  131. package/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.js +23 -3
  132. package/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.js.map +1 -1
  133. package/node_modules/@oozcitak/dom/package.json +72 -72
  134. package/node_modules/xmlbuilder2/CHANGELOG.md +95 -1
  135. package/node_modules/xmlbuilder2/README.md +5 -4
  136. package/node_modules/xmlbuilder2/lib/builder/XMLBuilderCBImpl.d.ts +3 -1
  137. package/node_modules/xmlbuilder2/lib/builder/XMLBuilderCBImpl.js +44 -53
  138. package/node_modules/xmlbuilder2/lib/builder/XMLBuilderCBImpl.js.map +1 -1
  139. package/node_modules/xmlbuilder2/lib/constants.d.ts +1 -0
  140. package/node_modules/xmlbuilder2/lib/constants.js +4 -0
  141. package/node_modules/xmlbuilder2/lib/constants.js.map +1 -0
  142. package/node_modules/xmlbuilder2/lib/interfaces.d.ts +20 -8
  143. package/node_modules/xmlbuilder2/lib/interfaces.js +1 -0
  144. package/node_modules/xmlbuilder2/lib/interfaces.js.map +1 -1
  145. package/node_modules/xmlbuilder2/lib/readers/BaseReader.d.ts +14 -1
  146. package/node_modules/xmlbuilder2/lib/readers/BaseReader.js +30 -1
  147. package/node_modules/xmlbuilder2/lib/readers/BaseReader.js.map +1 -1
  148. package/node_modules/xmlbuilder2/lib/readers/ObjectReader.js +12 -5
  149. package/node_modules/xmlbuilder2/lib/readers/ObjectReader.js.map +1 -1
  150. package/node_modules/xmlbuilder2/lib/readers/XMLReader.js +11 -5
  151. package/node_modules/xmlbuilder2/lib/readers/XMLReader.js.map +1 -1
  152. package/node_modules/xmlbuilder2/lib/writers/BaseWriter.d.ts +1 -1
  153. package/node_modules/xmlbuilder2/lib/writers/BaseWriter.js +58 -92
  154. package/node_modules/xmlbuilder2/lib/writers/BaseWriter.js.map +1 -1
  155. package/node_modules/xmlbuilder2/lib/writers/JSONWriter.js +1 -3
  156. package/node_modules/xmlbuilder2/lib/writers/JSONWriter.js.map +1 -1
  157. package/node_modules/xmlbuilder2/lib/writers/MapWriter.js +0 -2
  158. package/node_modules/xmlbuilder2/lib/writers/MapWriter.js.map +1 -1
  159. package/node_modules/xmlbuilder2/lib/writers/ObjectWriter.js +1 -2
  160. package/node_modules/xmlbuilder2/lib/writers/ObjectWriter.js.map +1 -1
  161. package/node_modules/xmlbuilder2/lib/writers/XMLWriter.js +1 -2
  162. package/node_modules/xmlbuilder2/lib/writers/XMLWriter.js.map +1 -1
  163. package/node_modules/xmlbuilder2/lib/writers/YAMLWriter.js +1 -3
  164. package/node_modules/xmlbuilder2/lib/writers/YAMLWriter.js.map +1 -1
  165. package/node_modules/xmlbuilder2/lib/xmlbuilder2.min.js +2 -2
  166. package/node_modules/xmlbuilder2/node_modules/js-yaml/CHANGELOG.md +6 -0
  167. package/node_modules/xmlbuilder2/node_modules/js-yaml/dist/js-yaml.js +2 -2
  168. package/node_modules/xmlbuilder2/node_modules/js-yaml/dist/js-yaml.min.js +1 -1
  169. package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/loader.js +1 -1
  170. package/node_modules/xmlbuilder2/node_modules/js-yaml/package.json +1 -1
  171. package/node_modules/xmlbuilder2/package.json +7 -7
  172. package/package.json +2 -2
  173. package/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl2.d.ts +0 -2
  174. package/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl2.js +0 -962
  175. package/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl2.js.map +0 -1
  176. package/node_modules/xmlbuilder2/node_modules/@types/node/LICENSE +0 -21
  177. package/node_modules/xmlbuilder2/node_modules/@types/node/README.md +0 -16
  178. package/node_modules/xmlbuilder2/node_modules/@types/node/assert/strict.d.ts +0 -8
  179. package/node_modules/xmlbuilder2/node_modules/@types/node/assert.d.ts +0 -957
  180. package/node_modules/xmlbuilder2/node_modules/@types/node/async_hooks.d.ts +0 -538
  181. package/node_modules/xmlbuilder2/node_modules/@types/node/buffer.d.ts +0 -2348
  182. package/node_modules/xmlbuilder2/node_modules/@types/node/child_process.d.ts +0 -1368
  183. package/node_modules/xmlbuilder2/node_modules/@types/node/cluster.d.ts +0 -410
  184. package/node_modules/xmlbuilder2/node_modules/@types/node/console.d.ts +0 -412
  185. package/node_modules/xmlbuilder2/node_modules/@types/node/constants.d.ts +0 -18
  186. package/node_modules/xmlbuilder2/node_modules/@types/node/crypto.d.ts +0 -3962
  187. package/node_modules/xmlbuilder2/node_modules/@types/node/dgram.d.ts +0 -545
  188. package/node_modules/xmlbuilder2/node_modules/@types/node/diagnostics_channel.d.ts +0 -191
  189. package/node_modules/xmlbuilder2/node_modules/@types/node/dns/promises.d.ts +0 -370
  190. package/node_modules/xmlbuilder2/node_modules/@types/node/dns.d.ts +0 -667
  191. package/node_modules/xmlbuilder2/node_modules/@types/node/dom-events.d.ts +0 -126
  192. package/node_modules/xmlbuilder2/node_modules/@types/node/domain.d.ts +0 -170
  193. package/node_modules/xmlbuilder2/node_modules/@types/node/events.d.ts +0 -682
  194. package/node_modules/xmlbuilder2/node_modules/@types/node/fs/promises.d.ts +0 -1189
  195. package/node_modules/xmlbuilder2/node_modules/@types/node/fs.d.ts +0 -4011
  196. package/node_modules/xmlbuilder2/node_modules/@types/node/globals.d.ts +0 -302
  197. package/node_modules/xmlbuilder2/node_modules/@types/node/globals.global.d.ts +0 -1
  198. package/node_modules/xmlbuilder2/node_modules/@types/node/http.d.ts +0 -1724
  199. package/node_modules/xmlbuilder2/node_modules/@types/node/http2.d.ts +0 -2129
  200. package/node_modules/xmlbuilder2/node_modules/@types/node/https.d.ts +0 -441
  201. package/node_modules/xmlbuilder2/node_modules/@types/node/index.d.ts +0 -134
  202. package/node_modules/xmlbuilder2/node_modules/@types/node/inspector.d.ts +0 -2748
  203. package/node_modules/xmlbuilder2/node_modules/@types/node/module.d.ts +0 -116
  204. package/node_modules/xmlbuilder2/node_modules/@types/node/net.d.ts +0 -886
  205. package/node_modules/xmlbuilder2/node_modules/@types/node/os.d.ts +0 -477
  206. package/node_modules/xmlbuilder2/node_modules/@types/node/package.json +0 -237
  207. package/node_modules/xmlbuilder2/node_modules/@types/node/path.d.ts +0 -191
  208. package/node_modules/xmlbuilder2/node_modules/@types/node/perf_hooks.d.ts +0 -638
  209. package/node_modules/xmlbuilder2/node_modules/@types/node/process.d.ts +0 -1485
  210. package/node_modules/xmlbuilder2/node_modules/@types/node/punycode.d.ts +0 -117
  211. package/node_modules/xmlbuilder2/node_modules/@types/node/querystring.d.ts +0 -131
  212. package/node_modules/xmlbuilder2/node_modules/@types/node/readline/promises.d.ts +0 -145
  213. package/node_modules/xmlbuilder2/node_modules/@types/node/readline.d.ts +0 -653
  214. package/node_modules/xmlbuilder2/node_modules/@types/node/repl.d.ts +0 -424
  215. package/node_modules/xmlbuilder2/node_modules/@types/node/stream/consumers.d.ts +0 -12
  216. package/node_modules/xmlbuilder2/node_modules/@types/node/stream/promises.d.ts +0 -42
  217. package/node_modules/xmlbuilder2/node_modules/@types/node/stream/web.d.ts +0 -330
  218. package/node_modules/xmlbuilder2/node_modules/@types/node/stream.d.ts +0 -1392
  219. package/node_modules/xmlbuilder2/node_modules/@types/node/string_decoder.d.ts +0 -67
  220. package/node_modules/xmlbuilder2/node_modules/@types/node/test.d.ts +0 -997
  221. package/node_modules/xmlbuilder2/node_modules/@types/node/timers/promises.d.ts +0 -93
  222. package/node_modules/xmlbuilder2/node_modules/@types/node/timers.d.ts +0 -101
  223. package/node_modules/xmlbuilder2/node_modules/@types/node/tls.d.ts +0 -1119
  224. package/node_modules/xmlbuilder2/node_modules/@types/node/trace_events.d.ts +0 -182
  225. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  226. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/assert.d.ts +0 -957
  227. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -538
  228. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2348
  229. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1368
  230. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/cluster.d.ts +0 -410
  231. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/console.d.ts +0 -412
  232. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/constants.d.ts +0 -18
  233. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/crypto.d.ts +0 -3961
  234. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/dgram.d.ts +0 -545
  235. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -191
  236. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -370
  237. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/dns.d.ts +0 -667
  238. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -126
  239. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  240. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/events.d.ts +0 -682
  241. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1189
  242. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/fs.d.ts +0 -4011
  243. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/globals.d.ts +0 -302
  244. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  245. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/http.d.ts +0 -1723
  246. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/http2.d.ts +0 -2129
  247. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/https.d.ts +0 -441
  248. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  249. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2748
  250. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/module.d.ts +0 -116
  251. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/net.d.ts +0 -886
  252. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/os.d.ts +0 -477
  253. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  254. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -638
  255. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/process.d.ts +0 -1485
  256. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  257. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/querystring.d.ts +0 -131
  258. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -145
  259. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/readline.d.ts +0 -653
  260. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/repl.d.ts +0 -424
  261. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  262. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -42
  263. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -330
  264. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/stream.d.ts +0 -1392
  265. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  266. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/test.d.ts +0 -997
  267. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  268. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/timers.d.ts +0 -101
  269. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/tls.d.ts +0 -1119
  270. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  271. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/tty.d.ts +0 -205
  272. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/url.d.ts +0 -892
  273. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/util.d.ts +0 -2044
  274. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/v8.d.ts +0 -635
  275. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/vm.d.ts +0 -894
  276. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/wasi.d.ts +0 -152
  277. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -693
  278. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  279. package/node_modules/xmlbuilder2/node_modules/@types/node/tty.d.ts +0 -205
  280. package/node_modules/xmlbuilder2/node_modules/@types/node/url.d.ts +0 -892
  281. package/node_modules/xmlbuilder2/node_modules/@types/node/util.d.ts +0 -2052
  282. package/node_modules/xmlbuilder2/node_modules/@types/node/v8.d.ts +0 -635
  283. package/node_modules/xmlbuilder2/node_modules/@types/node/vm.d.ts +0 -894
  284. package/node_modules/xmlbuilder2/node_modules/@types/node/wasi.d.ts +0 -152
  285. package/node_modules/xmlbuilder2/node_modules/@types/node/worker_threads.d.ts +0 -693
  286. package/node_modules/xmlbuilder2/node_modules/@types/node/zlib.d.ts +0 -517
  287. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/CHANGELOG.md +0 -0
  288. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/LICENSE +0 -0
  289. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/README.md +0 -0
  290. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/index.js +0 -0
  291. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/append/constant.js +0 -0
  292. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/append.js +0 -0
  293. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/count.js +0 -0
  294. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/help.js +0 -0
  295. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/store/constant.js +0 -0
  296. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/store/false.js +0 -0
  297. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/store/true.js +0 -0
  298. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/store.js +0 -0
  299. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/subparsers.js +0 -0
  300. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action/version.js +0 -0
  301. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action.js +0 -0
  302. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/action_container.js +0 -0
  303. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/argparse.js +0 -0
  304. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/argument/error.js +0 -0
  305. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/argument/exclusive.js +0 -0
  306. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/argument/group.js +0 -0
  307. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/argument_parser.js +0 -0
  308. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/const.js +0 -0
  309. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/help/added_formatters.js +0 -0
  310. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/help/formatter.js +0 -0
  311. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/namespace.js +0 -0
  312. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/lib/utils.js +0 -0
  313. /package/node_modules/{argparse → xmlbuilder2/node_modules/argparse}/package.json +0 -0
@@ -1,1723 +0,0 @@
1
- /**
2
- * To use the HTTP server and client one must `require('node: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': 'example.com',
17
- * 'accept': '*' }
18
- * ```
19
- *
20
- * Keys are lowercased. Values are not modified.
21
- *
22
- * In order to support the full spectrum of possible HTTP applications, the Node.js
23
- * HTTP API is very low-level. It deals with stream handling and message
24
- * parsing only. It parses a message into headers and body but it does not
25
- * parse the actual headers or the body.
26
- *
27
- * See `message.headers` for details on how duplicate headers are handled.
28
- *
29
- * The raw headers as they were received are retained in the `rawHeaders`property, which is an array of `[key, value, key2, value2, ...]`. For
30
- * example, the previous message header object might have a `rawHeaders`list like the following:
31
- *
32
- * ```js
33
- * [ 'ConTent-Length', '123456',
34
- * 'content-LENGTH', '123',
35
- * 'content-type', 'text/plain',
36
- * 'CONNECTION', 'keep-alive',
37
- * 'Host', 'example.com',
38
- * 'accepT', '*' ]
39
- * ```
40
- * @see [source](https://github.com/nodejs/node/blob/v20.1.0/lib/http.js)
41
- */
42
- declare module 'http' {
43
- import * as stream from 'node:stream';
44
- import { URL } from 'node:url';
45
- import { TcpSocketConnectOpts, Socket, Server as NetServer, LookupFunction } from 'node:net';
46
- import { LookupOptions } from 'node:dns';
47
- // incoming headers will never contain number
48
- interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> {
49
- accept?: string | undefined;
50
- 'accept-language'?: string | undefined;
51
- 'accept-patch'?: string | undefined;
52
- 'accept-ranges'?: string | undefined;
53
- 'access-control-allow-credentials'?: string | undefined;
54
- 'access-control-allow-headers'?: string | undefined;
55
- 'access-control-allow-methods'?: string | undefined;
56
- 'access-control-allow-origin'?: string | undefined;
57
- 'access-control-expose-headers'?: string | undefined;
58
- 'access-control-max-age'?: string | undefined;
59
- 'access-control-request-headers'?: string | undefined;
60
- 'access-control-request-method'?: string | undefined;
61
- age?: string | undefined;
62
- allow?: string | undefined;
63
- 'alt-svc'?: string | undefined;
64
- authorization?: string | undefined;
65
- 'cache-control'?: string | undefined;
66
- connection?: string | undefined;
67
- 'content-disposition'?: string | undefined;
68
- 'content-encoding'?: string | undefined;
69
- 'content-language'?: string | undefined;
70
- 'content-length'?: string | undefined;
71
- 'content-location'?: string | undefined;
72
- 'content-range'?: string | undefined;
73
- 'content-type'?: string | undefined;
74
- cookie?: string | undefined;
75
- date?: string | undefined;
76
- etag?: string | undefined;
77
- expect?: string | undefined;
78
- expires?: string | undefined;
79
- forwarded?: string | undefined;
80
- from?: string | undefined;
81
- host?: string | undefined;
82
- 'if-match'?: string | undefined;
83
- 'if-modified-since'?: string | undefined;
84
- 'if-none-match'?: string | undefined;
85
- 'if-unmodified-since'?: string | undefined;
86
- 'last-modified'?: string | undefined;
87
- location?: string | undefined;
88
- origin?: string | undefined;
89
- pragma?: string | undefined;
90
- 'proxy-authenticate'?: string | undefined;
91
- 'proxy-authorization'?: string | undefined;
92
- 'public-key-pins'?: string | undefined;
93
- range?: string | undefined;
94
- referer?: string | undefined;
95
- 'retry-after'?: string | undefined;
96
- 'sec-websocket-accept'?: string | undefined;
97
- 'sec-websocket-extensions'?: string | undefined;
98
- 'sec-websocket-key'?: string | undefined;
99
- 'sec-websocket-protocol'?: string | undefined;
100
- 'sec-websocket-version'?: string | undefined;
101
- 'set-cookie'?: string[] | undefined;
102
- 'strict-transport-security'?: string | undefined;
103
- tk?: string | undefined;
104
- trailer?: string | undefined;
105
- 'transfer-encoding'?: string | undefined;
106
- upgrade?: string | undefined;
107
- 'user-agent'?: string | undefined;
108
- vary?: string | undefined;
109
- via?: string | undefined;
110
- warning?: string | undefined;
111
- 'www-authenticate'?: string | undefined;
112
- }
113
- // outgoing headers allows numbers (as they are converted internally to strings)
114
- type OutgoingHttpHeader = number | string | string[];
115
- interface OutgoingHttpHeaders extends NodeJS.Dict<OutgoingHttpHeader> {}
116
- interface ClientRequestArgs {
117
- _defaultAgent?: Agent | undefined;
118
- agent?: Agent | boolean | undefined;
119
- auth?: string | null | undefined;
120
- // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278
121
- createConnection?:
122
- | ((options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket)
123
- | undefined;
124
- defaultPort?: number | string | undefined;
125
- family?: number | undefined;
126
- headers?: OutgoingHttpHeaders | undefined;
127
- hints?: LookupOptions['hints'];
128
- host?: string | null | undefined;
129
- hostname?: string | null | undefined;
130
- insecureHTTPParser?: boolean | undefined;
131
- localAddress?: string | undefined;
132
- localPort?: number | undefined;
133
- lookup?: LookupFunction | undefined;
134
- /**
135
- * @default 16384
136
- */
137
- maxHeaderSize?: number | undefined;
138
- method?: string | undefined;
139
- path?: string | null | undefined;
140
- port?: number | string | null | undefined;
141
- protocol?: string | null | undefined;
142
- setHost?: boolean | undefined;
143
- signal?: AbortSignal | undefined;
144
- socketPath?: string | undefined;
145
- timeout?: number | undefined;
146
- uniqueHeaders?: Array<string | string[]> | undefined;
147
- joinDuplicateHeaders?: boolean;
148
- }
149
- interface ServerOptions<
150
- Request extends typeof IncomingMessage = typeof IncomingMessage,
151
- Response extends typeof ServerResponse = typeof ServerResponse,
152
- > {
153
- /**
154
- * Specifies the `IncomingMessage` class to be used. Useful for extending the original `IncomingMessage`.
155
- */
156
- IncomingMessage?: Request | undefined;
157
- /**
158
- * Specifies the `ServerResponse` class to be used. Useful for extending the original `ServerResponse`.
159
- */
160
- ServerResponse?: Response | undefined;
161
- /**
162
- * Sets the timeout value in milliseconds for receiving the entire request from the client.
163
- * @see Server.requestTimeout for more information.
164
- * @default 300000
165
- * @since v18.0.0
166
- */
167
- requestTimeout?: number | undefined;
168
- /**
169
- * It joins the field line values of multiple headers in a request with `, ` instead of discarding the duplicates.
170
- * @default false
171
- * @since v18.14.0
172
- */
173
- joinDuplicateHeaders?: boolean;
174
- /**
175
- * The number of milliseconds of inactivity a server needs to wait for additional incoming data,
176
- * after it has finished writing the last response, before a socket will be destroyed.
177
- * @see Server.keepAliveTimeout for more information.
178
- * @default 5000
179
- * @since v18.0.0
180
- */
181
- keepAliveTimeout?: number | undefined;
182
- /**
183
- * Sets the interval value in milliseconds to check for request and headers timeout in incomplete requests.
184
- * @default 30000
185
- */
186
- connectionsCheckingInterval?: number | undefined;
187
- /**
188
- * Optionally overrides all `socket`s' `readableHighWaterMark` and `writableHighWaterMark`.
189
- * This affects `highWaterMark` property of both `IncomingMessage` and `ServerResponse`.
190
- * Default: @see stream.getDefaultHighWaterMark().
191
- * @since v20.1.0
192
- */
193
- highWaterMark?: number | undefined;
194
- /**
195
- * Use an insecure HTTP parser that accepts invalid HTTP headers when `true`.
196
- * Using the insecure parser should be avoided.
197
- * See --insecure-http-parser for more information.
198
- * @default false
199
- */
200
- insecureHTTPParser?: boolean | undefined;
201
- /**
202
- * Optionally overrides the value of
203
- * `--max-http-header-size` for requests received by this server, i.e.
204
- * the maximum length of request headers in bytes.
205
- * @default 16384
206
- * @since v13.3.0
207
- */
208
- maxHeaderSize?: number | undefined;
209
- /**
210
- * If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received.
211
- * @default true
212
- * @since v16.5.0
213
- */
214
- noDelay?: boolean | undefined;
215
- /**
216
- * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received,
217
- * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`.
218
- * @default false
219
- * @since v16.5.0
220
- */
221
- keepAlive?: boolean | undefined;
222
- /**
223
- * If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket.
224
- * @default 0
225
- * @since v16.5.0
226
- */
227
- keepAliveInitialDelay?: number | undefined;
228
- /**
229
- * A list of response headers that should be sent only once.
230
- * If the header's value is an array, the items will be joined using `; `.
231
- */
232
- uniqueHeaders?: Array<string | string[]> | undefined;
233
- }
234
- type RequestListener<
235
- Request extends typeof IncomingMessage = typeof IncomingMessage,
236
- Response extends typeof ServerResponse = typeof ServerResponse,
237
- > = (req: InstanceType<Request>, res: InstanceType<Response> & { req: InstanceType<Request> }) => void;
238
- /**
239
- * @since v0.1.17
240
- */
241
- class Server<
242
- Request extends typeof IncomingMessage = typeof IncomingMessage,
243
- Response extends typeof ServerResponse = typeof ServerResponse,
244
- > extends NetServer {
245
- constructor(requestListener?: RequestListener<Request, Response>);
246
- constructor(options: ServerOptions<Request, Response>, requestListener?: RequestListener<Request, Response>);
247
- /**
248
- * Sets the timeout value for sockets, and emits a `'timeout'` event on
249
- * the Server object, passing the socket as an argument, if a timeout
250
- * occurs.
251
- *
252
- * If there is a `'timeout'` event listener on the Server object, then it
253
- * will be called with the timed-out socket as an argument.
254
- *
255
- * By default, the Server does not timeout sockets. However, if a callback
256
- * is assigned to the Server's `'timeout'` event, timeouts must be handled
257
- * explicitly.
258
- * @since v0.9.12
259
- * @param [msecs=0 (no timeout)]
260
- */
261
- setTimeout(msecs?: number, callback?: () => void): this;
262
- setTimeout(callback: () => void): this;
263
- /**
264
- * Limits maximum incoming headers count. If set to 0, no limit will be applied.
265
- * @since v0.7.0
266
- */
267
- maxHeadersCount: number | null;
268
- /**
269
- * The maximum number of requests socket can handle
270
- * before closing keep alive connection.
271
- *
272
- * A value of `0` will disable the limit.
273
- *
274
- * When the limit is reached it will set the `Connection` header value to `close`,
275
- * but will not actually close the connection, subsequent requests sent
276
- * after the limit is reached will get `503 Service Unavailable` as a response.
277
- * @since v16.10.0
278
- */
279
- maxRequestsPerSocket: number | null;
280
- /**
281
- * The number of milliseconds of inactivity before a socket is presumed
282
- * to have timed out.
283
- *
284
- * A value of `0` will disable the timeout behavior on incoming connections.
285
- *
286
- * The socket timeout logic is set up on connection, so changing this
287
- * value only affects new connections to the server, not any existing connections.
288
- * @since v0.9.12
289
- */
290
- timeout: number;
291
- /**
292
- * Limit the amount of time the parser will wait to receive the complete HTTP
293
- * headers.
294
- *
295
- * If the timeout expires, the server responds with status 408 without
296
- * forwarding the request to the request listener and then closes the connection.
297
- *
298
- * It must be set to a non-zero value (e.g. 120 seconds) to protect against
299
- * potential Denial-of-Service attacks in case the server is deployed without a
300
- * reverse proxy in front.
301
- * @since v11.3.0, v10.14.0
302
- */
303
- headersTimeout: number;
304
- /**
305
- * The number of milliseconds of inactivity a server needs to wait for additional
306
- * incoming data, after it has finished writing the last response, before a socket
307
- * will be destroyed. If the server receives new data before the keep-alive
308
- * timeout has fired, it will reset the regular inactivity timeout, i.e.,`server.timeout`.
309
- *
310
- * A value of `0` will disable the keep-alive timeout behavior on incoming
311
- * connections.
312
- * A value of `0` makes the http server behave similarly to Node.js versions prior
313
- * to 8.0.0, which did not have a keep-alive timeout.
314
- *
315
- * The socket timeout logic is set up on connection, so changing this value only
316
- * affects new connections to the server, not any existing connections.
317
- * @since v8.0.0
318
- */
319
- keepAliveTimeout: number;
320
- /**
321
- * Sets the timeout value in milliseconds for receiving the entire request from
322
- * the client.
323
- *
324
- * If the timeout expires, the server responds with status 408 without
325
- * forwarding the request to the request listener and then closes the connection.
326
- *
327
- * It must be set to a non-zero value (e.g. 120 seconds) to protect against
328
- * potential Denial-of-Service attacks in case the server is deployed without a
329
- * reverse proxy in front.
330
- * @since v14.11.0
331
- */
332
- requestTimeout: number;
333
- /**
334
- * Closes all connections connected to this server.
335
- * @since v18.2.0
336
- */
337
- closeAllConnections(): void;
338
- /**
339
- * Closes all connections connected to this server which are not sending a request
340
- * or waiting for a response.
341
- * @since v18.2.0
342
- */
343
- closeIdleConnections(): void;
344
- addListener(event: string, listener: (...args: any[]) => void): this;
345
- addListener(event: 'close', listener: () => void): this;
346
- addListener(event: 'connection', listener: (socket: Socket) => void): this;
347
- addListener(event: 'error', listener: (err: Error) => void): this;
348
- addListener(event: 'listening', listener: () => void): this;
349
- addListener(event: 'checkContinue', listener: RequestListener<Request, Response>): this;
350
- addListener(event: 'checkExpectation', listener: RequestListener<Request, Response>): this;
351
- addListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
352
- addListener(event: 'connect', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
353
- addListener(event: 'dropRequest', listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
354
- addListener(event: 'request', listener: RequestListener<Request, Response>): this;
355
- addListener(event: 'upgrade', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
356
- emit(event: string, ...args: any[]): boolean;
357
- emit(event: 'close'): boolean;
358
- emit(event: 'connection', socket: Socket): boolean;
359
- emit(event: 'error', err: Error): boolean;
360
- emit(event: 'listening'): boolean;
361
- emit(
362
- event: 'checkContinue',
363
- req: InstanceType<Request>,
364
- res: InstanceType<Response> & { req: InstanceType<Request> },
365
- ): boolean;
366
- emit(
367
- event: 'checkExpectation',
368
- req: InstanceType<Request>,
369
- res: InstanceType<Response> & { req: InstanceType<Request> },
370
- ): boolean;
371
- emit(event: 'clientError', err: Error, socket: stream.Duplex): boolean;
372
- emit(event: 'connect', req: InstanceType<Request>, socket: stream.Duplex, head: Buffer): boolean;
373
- emit(event: 'dropRequest', req: InstanceType<Request>, socket: stream.Duplex): boolean;
374
- emit(
375
- event: 'request',
376
- req: InstanceType<Request>,
377
- res: InstanceType<Response> & { req: InstanceType<Request> },
378
- ): boolean;
379
- emit(event: 'upgrade', req: InstanceType<Request>, socket: stream.Duplex, head: Buffer): boolean;
380
- on(event: string, listener: (...args: any[]) => void): this;
381
- on(event: 'close', listener: () => void): this;
382
- on(event: 'connection', listener: (socket: Socket) => void): this;
383
- on(event: 'error', listener: (err: Error) => void): this;
384
- on(event: 'listening', listener: () => void): this;
385
- on(event: 'checkContinue', listener: RequestListener<Request, Response>): this;
386
- on(event: 'checkExpectation', listener: RequestListener<Request, Response>): this;
387
- on(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
388
- on(event: 'connect', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
389
- on(event: 'dropRequest', listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
390
- on(event: 'request', listener: RequestListener<Request, Response>): this;
391
- on(event: 'upgrade', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
392
- once(event: string, listener: (...args: any[]) => void): this;
393
- once(event: 'close', listener: () => void): this;
394
- once(event: 'connection', listener: (socket: Socket) => void): this;
395
- once(event: 'error', listener: (err: Error) => void): this;
396
- once(event: 'listening', listener: () => void): this;
397
- once(event: 'checkContinue', listener: RequestListener<Request, Response>): this;
398
- once(event: 'checkExpectation', listener: RequestListener<Request, Response>): this;
399
- once(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
400
- once(event: 'connect', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
401
- once(event: 'dropRequest', listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
402
- once(event: 'request', listener: RequestListener<Request, Response>): this;
403
- once(event: 'upgrade', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
404
- prependListener(event: string, listener: (...args: any[]) => void): this;
405
- prependListener(event: 'close', listener: () => void): this;
406
- prependListener(event: 'connection', listener: (socket: Socket) => void): this;
407
- prependListener(event: 'error', listener: (err: Error) => void): this;
408
- prependListener(event: 'listening', listener: () => void): this;
409
- prependListener(event: 'checkContinue', listener: RequestListener<Request, Response>): this;
410
- prependListener(event: 'checkExpectation', listener: RequestListener<Request, Response>): this;
411
- prependListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
412
- prependListener(event: 'connect', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
413
- prependListener(event: 'dropRequest', listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
414
- prependListener(event: 'request', listener: RequestListener<Request, Response>): this;
415
- prependListener(event: 'upgrade', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
416
- prependOnceListener(event: string, listener: (...args: any[]) => void): this;
417
- prependOnceListener(event: 'close', listener: () => void): this;
418
- prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this;
419
- prependOnceListener(event: 'error', listener: (err: Error) => void): this;
420
- prependOnceListener(event: 'listening', listener: () => void): this;
421
- prependOnceListener(event: 'checkContinue', listener: RequestListener<Request, Response>): this;
422
- prependOnceListener(event: 'checkExpectation', listener: RequestListener<Request, Response>): this;
423
- prependOnceListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
424
- prependOnceListener(event: 'connect', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
425
- prependOnceListener(event: 'dropRequest', listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
426
- prependOnceListener(event: 'request', listener: RequestListener<Request, Response>): this;
427
- prependOnceListener(event: 'upgrade', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
428
- }
429
- /**
430
- * This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract outgoing message from
431
- * the perspective of the participants of an HTTP transaction.
432
- * @since v0.1.17
433
- */
434
- class OutgoingMessage<Request extends IncomingMessage = IncomingMessage> extends stream.Writable {
435
- readonly req: Request;
436
- chunkedEncoding: boolean;
437
- shouldKeepAlive: boolean;
438
- useChunkedEncodingByDefault: boolean;
439
- sendDate: boolean;
440
- /**
441
- * @deprecated Use `writableEnded` instead.
442
- */
443
- finished: boolean;
444
- /**
445
- * Read-only. `true` if the headers were sent, otherwise `false`.
446
- * @since v0.9.3
447
- */
448
- readonly headersSent: boolean;
449
- /**
450
- * Alias of `outgoingMessage.socket`.
451
- * @since v0.3.0
452
- * @deprecated Since v15.12.0,v14.17.1 - Use `socket` instead.
453
- */
454
- readonly connection: Socket | null;
455
- /**
456
- * Reference to the underlying socket. Usually, users will not want to access
457
- * this property.
458
- *
459
- * After calling `outgoingMessage.end()`, this property will be nulled.
460
- * @since v0.3.0
461
- */
462
- readonly socket: Socket | null;
463
- constructor();
464
- /**
465
- * Once a socket is associated with the message and is connected,`socket.setTimeout()` will be called with `msecs` as the first parameter.
466
- * @since v0.9.12
467
- * @param callback Optional function to be called when a timeout occurs. Same as binding to the `timeout` event.
468
- */
469
- setTimeout(msecs: number, callback?: () => void): this;
470
- /**
471
- * Sets a single header value. If the header already exists in the to-be-sent
472
- * headers, its value will be replaced. Use an array of strings to send multiple
473
- * headers with the same name.
474
- * @since v0.4.0
475
- * @param name Header name
476
- * @param value Header value
477
- */
478
- setHeader(name: string, value: number | string | ReadonlyArray<string>): this;
479
- /**
480
- * Append a single header value for the header object.
481
- *
482
- * If the value is an array, this is equivalent of calling this method multiple
483
- * times.
484
- *
485
- * If there were no previous value for the header, this is equivalent of calling `outgoingMessage.setHeader(name, value)`.
486
- *
487
- * Depending of the value of `options.uniqueHeaders` when the client request or the
488
- * server were created, this will end up in the header being sent multiple times or
489
- * a single time with values joined using `; `.
490
- * @since v18.3.0, v16.17.0
491
- * @param name Header name
492
- * @param value Header value
493
- */
494
- appendHeader(name: string, value: string | ReadonlyArray<string>): this;
495
- /**
496
- * Gets the value of the HTTP header with the given name. If that header is not
497
- * set, the returned value will be `undefined`.
498
- * @since v0.4.0
499
- * @param name Name of header
500
- */
501
- getHeader(name: string): number | string | string[] | undefined;
502
- /**
503
- * Returns a shallow copy of the current outgoing headers. Since a shallow
504
- * copy is used, array values may be mutated without additional calls to
505
- * various header-related HTTP module methods. The keys of the returned
506
- * object are the header names and the values are the respective header
507
- * values. All header names are lowercase.
508
- *
509
- * The object returned by the `outgoingMessage.getHeaders()` method does
510
- * not prototypically inherit from the JavaScript `Object`. This means that
511
- * typical `Object` methods such as `obj.toString()`, `obj.hasOwnProperty()`,
512
- * and others are not defined and will not work.
513
- *
514
- * ```js
515
- * outgoingMessage.setHeader('Foo', 'bar');
516
- * outgoingMessage.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);
517
- *
518
- * const headers = outgoingMessage.getHeaders();
519
- * // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] }
520
- * ```
521
- * @since v7.7.0
522
- */
523
- getHeaders(): OutgoingHttpHeaders;
524
- /**
525
- * Returns an array containing the unique names of the current outgoing headers.
526
- * All names are lowercase.
527
- * @since v7.7.0
528
- */
529
- getHeaderNames(): string[];
530
- /**
531
- * Returns `true` if the header identified by `name` is currently set in the
532
- * outgoing headers. The header name is case-insensitive.
533
- *
534
- * ```js
535
- * const hasContentType = outgoingMessage.hasHeader('content-type');
536
- * ```
537
- * @since v7.7.0
538
- */
539
- hasHeader(name: string): boolean;
540
- /**
541
- * Removes a header that is queued for implicit sending.
542
- *
543
- * ```js
544
- * outgoingMessage.removeHeader('Content-Encoding');
545
- * ```
546
- * @since v0.4.0
547
- * @param name Header name
548
- */
549
- removeHeader(name: string): void;
550
- /**
551
- * Adds HTTP trailers (headers but at the end of the message) to the message.
552
- *
553
- * Trailers will **only** be emitted if the message is chunked encoded. If not,
554
- * the trailers will be silently discarded.
555
- *
556
- * HTTP requires the `Trailer` header to be sent to emit trailers,
557
- * with a list of header field names in its value, e.g.
558
- *
559
- * ```js
560
- * message.writeHead(200, { 'Content-Type': 'text/plain',
561
- * 'Trailer': 'Content-MD5' });
562
- * message.write(fileData);
563
- * message.addTrailers({ 'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667' });
564
- * message.end();
565
- * ```
566
- *
567
- * Attempting to set a header field name or value that contains invalid characters
568
- * will result in a `TypeError` being thrown.
569
- * @since v0.3.0
570
- */
571
- addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void;
572
- /**
573
- * Flushes the message headers.
574
- *
575
- * For efficiency reason, Node.js normally buffers the message headers
576
- * until `outgoingMessage.end()` is called or the first chunk of message data
577
- * is written. It then tries to pack the headers and data into a single TCP
578
- * packet.
579
- *
580
- * It is usually desired (it saves a TCP round-trip), but not when the first
581
- * data is not sent until possibly much later. `outgoingMessage.flushHeaders()`bypasses the optimization and kickstarts the message.
582
- * @since v1.6.0
583
- */
584
- flushHeaders(): void;
585
- }
586
- /**
587
- * This object is created internally by an HTTP server, not by the user. It is
588
- * passed as the second parameter to the `'request'` event.
589
- * @since v0.1.17
590
- */
591
- class ServerResponse<Request extends IncomingMessage = IncomingMessage> extends OutgoingMessage<Request> {
592
- /**
593
- * When using implicit headers (not calling `response.writeHead()` explicitly),
594
- * this property controls the status code that will be sent to the client when
595
- * the headers get flushed.
596
- *
597
- * ```js
598
- * response.statusCode = 404;
599
- * ```
600
- *
601
- * After response header was sent to the client, this property indicates the
602
- * status code which was sent out.
603
- * @since v0.4.0
604
- */
605
- statusCode: number;
606
- /**
607
- * When using implicit headers (not calling `response.writeHead()` explicitly),
608
- * this property controls the status message that will be sent to the client when
609
- * the headers get flushed. If this is left as `undefined` then the standard
610
- * message for the status code will be used.
611
- *
612
- * ```js
613
- * response.statusMessage = 'Not found';
614
- * ```
615
- *
616
- * After response header was sent to the client, this property indicates the
617
- * status message which was sent out.
618
- * @since v0.11.8
619
- */
620
- statusMessage: string;
621
- /**
622
- * If set to `true`, Node.js will check whether the `Content-Length`header value and the size of the body, in bytes, are equal.
623
- * Mismatching the `Content-Length` header value will result
624
- * in an `Error` being thrown, identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`.
625
- * @since v18.10.0, v16.18.0
626
- */
627
- strictContentLength: boolean;
628
- constructor(req: Request);
629
- assignSocket(socket: Socket): void;
630
- detachSocket(socket: Socket): void;
631
- /**
632
- * Sends an HTTP/1.1 100 Continue message to the client, indicating that
633
- * the request body should be sent. See the `'checkContinue'` event on`Server`.
634
- * @since v0.3.0
635
- */
636
- writeContinue(callback?: () => void): void;
637
- /**
638
- * Sends an HTTP/1.1 103 Early Hints message to the client with a Link header,
639
- * indicating that the user agent can preload/preconnect the linked resources.
640
- * The `hints` is an object containing the values of headers to be sent with
641
- * early hints message. The optional `callback` argument will be called when
642
- * the response message has been written.
643
- *
644
- * **Example**
645
- *
646
- * ```js
647
- * const earlyHintsLink = '</styles.css>; rel=preload; as=style';
648
- * response.writeEarlyHints({
649
- * 'link': earlyHintsLink,
650
- * });
651
- *
652
- * const earlyHintsLinks = [
653
- * '</styles.css>; rel=preload; as=style',
654
- * '</scripts.js>; rel=preload; as=script',
655
- * ];
656
- * response.writeEarlyHints({
657
- * 'link': earlyHintsLinks,
658
- * 'x-trace-id': 'id for diagnostics',
659
- * });
660
- *
661
- * const earlyHintsCallback = () => console.log('early hints message sent');
662
- * response.writeEarlyHints({
663
- * 'link': earlyHintsLinks,
664
- * }, earlyHintsCallback);
665
- * ```
666
- * @since v18.11.0
667
- * @param hints An object containing the values of headers
668
- * @param callback Will be called when the response message has been written
669
- */
670
- writeEarlyHints(hints: Record<string, string | string[]>, callback?: () => void): void;
671
- /**
672
- * Sends a response header to the request. The status code is a 3-digit HTTP
673
- * status code, like `404`. The last argument, `headers`, are the response headers.
674
- * Optionally one can give a human-readable `statusMessage` as the second
675
- * argument.
676
- *
677
- * `headers` may be an `Array` where the keys and values are in the same list.
678
- * It is _not_ a list of tuples. So, the even-numbered offsets are key values,
679
- * and the odd-numbered offsets are the associated values. The array is in the same
680
- * format as `request.rawHeaders`.
681
- *
682
- * Returns a reference to the `ServerResponse`, so that calls can be chained.
683
- *
684
- * ```js
685
- * const body = 'hello world';
686
- * response
687
- * .writeHead(200, {
688
- * 'Content-Length': Buffer.byteLength(body),
689
- * 'Content-Type': 'text/plain',
690
- * })
691
- * .end(body);
692
- * ```
693
- *
694
- * This method must only be called once on a message and it must
695
- * be called before `response.end()` is called.
696
- *
697
- * If `response.write()` or `response.end()` are called before calling
698
- * this, the implicit/mutable headers will be calculated and call this function.
699
- *
700
- * When headers have been set with `response.setHeader()`, they will be merged
701
- * with any headers passed to `response.writeHead()`, with the headers passed
702
- * to `response.writeHead()` given precedence.
703
- *
704
- * If this method is called and `response.setHeader()` has not been called,
705
- * it will directly write the supplied header values onto the network channel
706
- * without caching internally, and the `response.getHeader()` on the header
707
- * will not yield the expected result. If progressive population of headers is
708
- * desired with potential future retrieval and modification, use `response.setHeader()` instead.
709
- *
710
- * ```js
711
- * // Returns content-type = text/plain
712
- * const server = http.createServer((req, res) => {
713
- * res.setHeader('Content-Type', 'text/html');
714
- * res.setHeader('X-Foo', 'bar');
715
- * res.writeHead(200, { 'Content-Type': 'text/plain' });
716
- * res.end('ok');
717
- * });
718
- * ```
719
- *
720
- * `Content-Length` is read in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. Node.js
721
- * will check whether `Content-Length` and the length of the body which has
722
- * been transmitted are equal or not.
723
- *
724
- * Attempting to set a header field name or value that contains invalid characters
725
- * will result in a \[`Error`\]\[\] being thrown.
726
- * @since v0.1.30
727
- */
728
- writeHead(
729
- statusCode: number,
730
- statusMessage?: string,
731
- headers?: OutgoingHttpHeaders | OutgoingHttpHeader[],
732
- ): this;
733
- writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
734
- /**
735
- * Sends a HTTP/1.1 102 Processing message to the client, indicating that
736
- * the request body should be sent.
737
- * @since v10.0.0
738
- */
739
- writeProcessing(): void;
740
- }
741
- interface InformationEvent {
742
- statusCode: number;
743
- statusMessage: string;
744
- httpVersion: string;
745
- httpVersionMajor: number;
746
- httpVersionMinor: number;
747
- headers: IncomingHttpHeaders;
748
- rawHeaders: string[];
749
- }
750
- /**
751
- * This object is created internally and returned from {@link request}. It
752
- * represents an _in-progress_ request whose header has already been queued. The
753
- * header is still mutable using the `setHeader(name, value)`,`getHeader(name)`, `removeHeader(name)` API. The actual header will
754
- * be sent along with the first data chunk or when calling `request.end()`.
755
- *
756
- * To get the response, add a listener for `'response'` to the request object.`'response'` will be emitted from the request object when the response
757
- * headers have been received. The `'response'` event is executed with one
758
- * argument which is an instance of {@link IncomingMessage}.
759
- *
760
- * During the `'response'` event, one can add listeners to the
761
- * response object; particularly to listen for the `'data'` event.
762
- *
763
- * If no `'response'` handler is added, then the response will be
764
- * entirely discarded. However, if a `'response'` event handler is added,
765
- * then the data from the response object **must** be consumed, either by
766
- * calling `response.read()` whenever there is a `'readable'` event, or
767
- * by adding a `'data'` handler, or by calling the `.resume()` method.
768
- * Until the data is consumed, the `'end'` event will not fire. Also, until
769
- * the data is read it will consume memory that can eventually lead to a
770
- * 'process out of memory' error.
771
- *
772
- * For backward compatibility, `res` will only emit `'error'` if there is an`'error'` listener registered.
773
- *
774
- * Set `Content-Length` header to limit the response body size.
775
- * If `response.strictContentLength` is set to `true`, mismatching the`Content-Length` header value will result in an `Error` being thrown,
776
- * identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`.
777
- *
778
- * `Content-Length` value should be in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes.
779
- * @since v0.1.17
780
- */
781
- class ClientRequest extends OutgoingMessage {
782
- /**
783
- * The `request.aborted` property will be `true` if the request has
784
- * been aborted.
785
- * @since v0.11.14
786
- * @deprecated Since v17.0.0,v16.12.0 - Check `destroyed` instead.
787
- */
788
- aborted: boolean;
789
- /**
790
- * The request host.
791
- * @since v14.5.0, v12.19.0
792
- */
793
- host: string;
794
- /**
795
- * The request protocol.
796
- * @since v14.5.0, v12.19.0
797
- */
798
- protocol: string;
799
- /**
800
- * When sending request through a keep-alive enabled agent, the underlying socket
801
- * might be reused. But if server closes connection at unfortunate time, client
802
- * may run into a 'ECONNRESET' error.
803
- *
804
- * ```js
805
- * const http = require('node:http');
806
- *
807
- * // Server has a 5 seconds keep-alive timeout by default
808
- * http
809
- * .createServer((req, res) => {
810
- * res.write('hello\n');
811
- * res.end();
812
- * })
813
- * .listen(3000);
814
- *
815
- * setInterval(() => {
816
- * // Adapting a keep-alive agent
817
- * http.get('http://localhost:3000', { agent }, (res) => {
818
- * res.on('data', (data) => {
819
- * // Do nothing
820
- * });
821
- * });
822
- * }, 5000); // Sending request on 5s interval so it's easy to hit idle timeout
823
- * ```
824
- *
825
- * By marking a request whether it reused socket or not, we can do
826
- * automatic error retry base on it.
827
- *
828
- * ```js
829
- * const http = require('node:http');
830
- * const agent = new http.Agent({ keepAlive: true });
831
- *
832
- * function retriableRequest() {
833
- * const req = http
834
- * .get('http://localhost:3000', { agent }, (res) => {
835
- * // ...
836
- * })
837
- * .on('error', (err) => {
838
- * // Check if retry is needed
839
- * if (req.reusedSocket &#x26;&#x26; err.code === 'ECONNRESET') {
840
- * retriableRequest();
841
- * }
842
- * });
843
- * }
844
- *
845
- * retriableRequest();
846
- * ```
847
- * @since v13.0.0, v12.16.0
848
- */
849
- reusedSocket: boolean;
850
- /**
851
- * Limits maximum response headers count. If set to 0, no limit will be applied.
852
- */
853
- maxHeadersCount: number;
854
- constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void);
855
- /**
856
- * The request method.
857
- * @since v0.1.97
858
- */
859
- method: string;
860
- /**
861
- * The request path.
862
- * @since v0.4.0
863
- */
864
- path: string;
865
- /**
866
- * Marks the request as aborting. Calling this will cause remaining data
867
- * in the response to be dropped and the socket to be destroyed.
868
- * @since v0.3.8
869
- * @deprecated Since v14.1.0,v13.14.0 - Use `destroy` instead.
870
- */
871
- abort(): void;
872
- onSocket(socket: Socket): void;
873
- /**
874
- * Once a socket is assigned to this request and is connected `socket.setTimeout()` will be called.
875
- * @since v0.5.9
876
- * @param timeout Milliseconds before a request times out.
877
- * @param callback Optional function to be called when a timeout occurs. Same as binding to the `'timeout'` event.
878
- */
879
- setTimeout(timeout: number, callback?: () => void): this;
880
- /**
881
- * Once a socket is assigned to this request and is connected `socket.setNoDelay()` will be called.
882
- * @since v0.5.9
883
- */
884
- setNoDelay(noDelay?: boolean): void;
885
- /**
886
- * Once a socket is assigned to this request and is connected `socket.setKeepAlive()` will be called.
887
- * @since v0.5.9
888
- */
889
- setSocketKeepAlive(enable?: boolean, initialDelay?: number): void;
890
- /**
891
- * Returns an array containing the unique names of the current outgoing raw
892
- * headers. Header names are returned with their exact casing being set.
893
- *
894
- * ```js
895
- * request.setHeader('Foo', 'bar');
896
- * request.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);
897
- *
898
- * const headerNames = request.getRawHeaderNames();
899
- * // headerNames === ['Foo', 'Set-Cookie']
900
- * ```
901
- * @since v15.13.0, v14.17.0
902
- */
903
- getRawHeaderNames(): string[];
904
- /**
905
- * @deprecated
906
- */
907
- addListener(event: 'abort', listener: () => void): this;
908
- addListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
909
- addListener(event: 'continue', listener: () => void): this;
910
- addListener(event: 'information', listener: (info: InformationEvent) => void): this;
911
- addListener(event: 'response', listener: (response: IncomingMessage) => void): this;
912
- addListener(event: 'socket', listener: (socket: Socket) => void): this;
913
- addListener(event: 'timeout', listener: () => void): this;
914
- addListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
915
- addListener(event: 'close', listener: () => void): this;
916
- addListener(event: 'drain', listener: () => void): this;
917
- addListener(event: 'error', listener: (err: Error) => void): this;
918
- addListener(event: 'finish', listener: () => void): this;
919
- addListener(event: 'pipe', listener: (src: stream.Readable) => void): this;
920
- addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this;
921
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
922
- /**
923
- * @deprecated
924
- */
925
- on(event: 'abort', listener: () => void): this;
926
- on(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
927
- on(event: 'continue', listener: () => void): this;
928
- on(event: 'information', listener: (info: InformationEvent) => void): this;
929
- on(event: 'response', listener: (response: IncomingMessage) => void): this;
930
- on(event: 'socket', listener: (socket: Socket) => void): this;
931
- on(event: 'timeout', listener: () => void): this;
932
- on(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
933
- on(event: 'close', listener: () => void): this;
934
- on(event: 'drain', listener: () => void): this;
935
- on(event: 'error', listener: (err: Error) => void): this;
936
- on(event: 'finish', listener: () => void): this;
937
- on(event: 'pipe', listener: (src: stream.Readable) => void): this;
938
- on(event: 'unpipe', listener: (src: stream.Readable) => void): this;
939
- on(event: string | symbol, listener: (...args: any[]) => void): this;
940
- /**
941
- * @deprecated
942
- */
943
- once(event: 'abort', listener: () => void): this;
944
- once(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
945
- once(event: 'continue', listener: () => void): this;
946
- once(event: 'information', listener: (info: InformationEvent) => void): this;
947
- once(event: 'response', listener: (response: IncomingMessage) => void): this;
948
- once(event: 'socket', listener: (socket: Socket) => void): this;
949
- once(event: 'timeout', listener: () => void): this;
950
- once(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
951
- once(event: 'close', listener: () => void): this;
952
- once(event: 'drain', listener: () => void): this;
953
- once(event: 'error', listener: (err: Error) => void): this;
954
- once(event: 'finish', listener: () => void): this;
955
- once(event: 'pipe', listener: (src: stream.Readable) => void): this;
956
- once(event: 'unpipe', listener: (src: stream.Readable) => void): this;
957
- once(event: string | symbol, listener: (...args: any[]) => void): this;
958
- /**
959
- * @deprecated
960
- */
961
- prependListener(event: 'abort', listener: () => void): this;
962
- prependListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
963
- prependListener(event: 'continue', listener: () => void): this;
964
- prependListener(event: 'information', listener: (info: InformationEvent) => void): this;
965
- prependListener(event: 'response', listener: (response: IncomingMessage) => void): this;
966
- prependListener(event: 'socket', listener: (socket: Socket) => void): this;
967
- prependListener(event: 'timeout', listener: () => void): this;
968
- prependListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
969
- prependListener(event: 'close', listener: () => void): this;
970
- prependListener(event: 'drain', listener: () => void): this;
971
- prependListener(event: 'error', listener: (err: Error) => void): this;
972
- prependListener(event: 'finish', listener: () => void): this;
973
- prependListener(event: 'pipe', listener: (src: stream.Readable) => void): this;
974
- prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this;
975
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
976
- /**
977
- * @deprecated
978
- */
979
- prependOnceListener(event: 'abort', listener: () => void): this;
980
- prependOnceListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
981
- prependOnceListener(event: 'continue', listener: () => void): this;
982
- prependOnceListener(event: 'information', listener: (info: InformationEvent) => void): this;
983
- prependOnceListener(event: 'response', listener: (response: IncomingMessage) => void): this;
984
- prependOnceListener(event: 'socket', listener: (socket: Socket) => void): this;
985
- prependOnceListener(event: 'timeout', listener: () => void): this;
986
- prependOnceListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
987
- prependOnceListener(event: 'close', listener: () => void): this;
988
- prependOnceListener(event: 'drain', listener: () => void): this;
989
- prependOnceListener(event: 'error', listener: (err: Error) => void): this;
990
- prependOnceListener(event: 'finish', listener: () => void): this;
991
- prependOnceListener(event: 'pipe', listener: (src: stream.Readable) => void): this;
992
- prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this;
993
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
994
- }
995
- /**
996
- * 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
997
- * access response
998
- * status, headers, and data.
999
- *
1000
- * Different from its `socket` value which is a subclass of `stream.Duplex`, the`IncomingMessage` itself extends `stream.Readable` and is created separately to
1001
- * parse and emit the incoming HTTP headers and payload, as the underlying socket
1002
- * may be reused multiple times in case of keep-alive.
1003
- * @since v0.1.17
1004
- */
1005
- class IncomingMessage extends stream.Readable {
1006
- constructor(socket: Socket);
1007
- /**
1008
- * The `message.aborted` property will be `true` if the request has
1009
- * been aborted.
1010
- * @since v10.1.0
1011
- * @deprecated Since v17.0.0,v16.12.0 - Check `message.destroyed` from <a href="stream.html#class-streamreadable" class="type">stream.Readable</a>.
1012
- */
1013
- aborted: boolean;
1014
- /**
1015
- * In case of server request, the HTTP version sent by the client. In the case of
1016
- * client response, the HTTP version of the connected-to server.
1017
- * Probably either `'1.1'` or `'1.0'`.
1018
- *
1019
- * Also `message.httpVersionMajor` is the first integer and`message.httpVersionMinor` is the second.
1020
- * @since v0.1.1
1021
- */
1022
- httpVersion: string;
1023
- httpVersionMajor: number;
1024
- httpVersionMinor: number;
1025
- /**
1026
- * The `message.complete` property will be `true` if a complete HTTP message has
1027
- * been received and successfully parsed.
1028
- *
1029
- * This property is particularly useful as a means of determining if a client or
1030
- * server fully transmitted a message before a connection was terminated:
1031
- *
1032
- * ```js
1033
- * const req = http.request({
1034
- * host: '127.0.0.1',
1035
- * port: 8080,
1036
- * method: 'POST',
1037
- * }, (res) => {
1038
- * res.resume();
1039
- * res.on('end', () => {
1040
- * if (!res.complete)
1041
- * console.error(
1042
- * 'The connection was terminated while the message was still being sent');
1043
- * });
1044
- * });
1045
- * ```
1046
- * @since v0.3.0
1047
- */
1048
- complete: boolean;
1049
- /**
1050
- * Alias for `message.socket`.
1051
- * @since v0.1.90
1052
- * @deprecated Since v16.0.0 - Use `socket`.
1053
- */
1054
- connection: Socket;
1055
- /**
1056
- * The `net.Socket` object associated with the connection.
1057
- *
1058
- * With HTTPS support, use `request.socket.getPeerCertificate()` to obtain the
1059
- * client's authentication details.
1060
- *
1061
- * This property is guaranteed to be an instance of the `net.Socket` class,
1062
- * a subclass of `stream.Duplex`, unless the user specified a socket
1063
- * type other than `net.Socket` or internally nulled.
1064
- * @since v0.3.0
1065
- */
1066
- socket: Socket;
1067
- /**
1068
- * The request/response headers object.
1069
- *
1070
- * Key-value pairs of header names and values. Header names are lower-cased.
1071
- *
1072
- * ```js
1073
- * // Prints something like:
1074
- * //
1075
- * // { 'user-agent': 'curl/7.22.0',
1076
- * // host: '127.0.0.1:8000',
1077
- * // accept: '*' }
1078
- * console.log(request.headers);
1079
- * ```
1080
- *
1081
- * Duplicates in raw headers are handled in the following ways, depending on the
1082
- * header name:
1083
- *
1084
- * * Duplicates of `age`, `authorization`, `content-length`, `content-type`,`etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`,`last-modified`, `location`,
1085
- * `max-forwards`, `proxy-authorization`, `referer`,`retry-after`, `server`, or `user-agent` are discarded.
1086
- * To allow duplicate values of the headers listed above to be joined,
1087
- * use the option `joinDuplicateHeaders` in {@link request} and {@link createServer}. See RFC 9110 Section 5.3 for more
1088
- * information.
1089
- * * `set-cookie` is always an array. Duplicates are added to the array.
1090
- * * For duplicate `cookie` headers, the values are joined together with `; `.
1091
- * * For all other headers, the values are joined together with `, `.
1092
- * @since v0.1.5
1093
- */
1094
- headers: IncomingHttpHeaders;
1095
- /**
1096
- * Similar to `message.headers`, but there is no join logic and the values are
1097
- * always arrays of strings, even for headers received just once.
1098
- *
1099
- * ```js
1100
- * // Prints something like:
1101
- * //
1102
- * // { 'user-agent': ['curl/7.22.0'],
1103
- * // host: ['127.0.0.1:8000'],
1104
- * // accept: ['*'] }
1105
- * console.log(request.headersDistinct);
1106
- * ```
1107
- * @since v18.3.0, v16.17.0
1108
- */
1109
- headersDistinct: NodeJS.Dict<string[]>;
1110
- /**
1111
- * The raw request/response headers list exactly as they were received.
1112
- *
1113
- * The keys and values are in the same list. It is _not_ a
1114
- * list of tuples. So, the even-numbered offsets are key values, and the
1115
- * odd-numbered offsets are the associated values.
1116
- *
1117
- * Header names are not lowercased, and duplicates are not merged.
1118
- *
1119
- * ```js
1120
- * // Prints something like:
1121
- * //
1122
- * // [ 'user-agent',
1123
- * // 'this is invalid because there can be only one',
1124
- * // 'User-Agent',
1125
- * // 'curl/7.22.0',
1126
- * // 'Host',
1127
- * // '127.0.0.1:8000',
1128
- * // 'ACCEPT',
1129
- * // '*' ]
1130
- * console.log(request.rawHeaders);
1131
- * ```
1132
- * @since v0.11.6
1133
- */
1134
- rawHeaders: string[];
1135
- /**
1136
- * The request/response trailers object. Only populated at the `'end'` event.
1137
- * @since v0.3.0
1138
- */
1139
- trailers: NodeJS.Dict<string>;
1140
- /**
1141
- * Similar to `message.trailers`, but there is no join logic and the values are
1142
- * always arrays of strings, even for headers received just once.
1143
- * Only populated at the `'end'` event.
1144
- * @since v18.3.0, v16.17.0
1145
- */
1146
- trailersDistinct: NodeJS.Dict<string[]>;
1147
- /**
1148
- * The raw request/response trailer keys and values exactly as they were
1149
- * received. Only populated at the `'end'` event.
1150
- * @since v0.11.6
1151
- */
1152
- rawTrailers: string[];
1153
- /**
1154
- * Calls `message.socket.setTimeout(msecs, callback)`.
1155
- * @since v0.5.9
1156
- */
1157
- setTimeout(msecs: number, callback?: () => void): this;
1158
- /**
1159
- * **Only valid for request obtained from {@link Server}.**
1160
- *
1161
- * The request method as a string. Read only. Examples: `'GET'`, `'DELETE'`.
1162
- * @since v0.1.1
1163
- */
1164
- method?: string | undefined;
1165
- /**
1166
- * **Only valid for request obtained from {@link Server}.**
1167
- *
1168
- * Request URL string. This contains only the URL that is present in the actual
1169
- * HTTP request. Take the following request:
1170
- *
1171
- * ```http
1172
- * GET /status?name=ryan HTTP/1.1
1173
- * Accept: text/plain
1174
- * ```
1175
- *
1176
- * To parse the URL into its parts:
1177
- *
1178
- * ```js
1179
- * new URL(request.url, `http://${request.headers.host}`);
1180
- * ```
1181
- *
1182
- * When `request.url` is `'/status?name=ryan'` and `request.headers.host` is`'localhost:3000'`:
1183
- *
1184
- * ```console
1185
- * $ node
1186
- * > new URL(request.url, `http://${request.headers.host}`)
1187
- * URL {
1188
- * href: 'http://localhost:3000/status?name=ryan',
1189
- * origin: 'http://localhost:3000',
1190
- * protocol: 'http:',
1191
- * username: '',
1192
- * password: '',
1193
- * host: 'localhost:3000',
1194
- * hostname: 'localhost',
1195
- * port: '3000',
1196
- * pathname: '/status',
1197
- * search: '?name=ryan',
1198
- * searchParams: URLSearchParams { 'name' => 'ryan' },
1199
- * hash: ''
1200
- * }
1201
- * ```
1202
- * @since v0.1.90
1203
- */
1204
- url?: string | undefined;
1205
- /**
1206
- * **Only valid for response obtained from {@link ClientRequest}.**
1207
- *
1208
- * The 3-digit HTTP response status code. E.G. `404`.
1209
- * @since v0.1.1
1210
- */
1211
- statusCode?: number | undefined;
1212
- /**
1213
- * **Only valid for response obtained from {@link ClientRequest}.**
1214
- *
1215
- * The HTTP response status message (reason phrase). E.G. `OK` or `Internal Server Error`.
1216
- * @since v0.11.10
1217
- */
1218
- statusMessage?: string | undefined;
1219
- /**
1220
- * 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
1221
- * as an argument to any listeners on the event.
1222
- * @since v0.3.0
1223
- */
1224
- destroy(error?: Error): this;
1225
- }
1226
- interface AgentOptions extends Partial<TcpSocketConnectOpts> {
1227
- /**
1228
- * Keep sockets around in a pool to be used by other requests in the future. Default = false
1229
- */
1230
- keepAlive?: boolean | undefined;
1231
- /**
1232
- * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000.
1233
- * Only relevant if keepAlive is set to true.
1234
- */
1235
- keepAliveMsecs?: number | undefined;
1236
- /**
1237
- * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
1238
- */
1239
- maxSockets?: number | undefined;
1240
- /**
1241
- * Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity.
1242
- */
1243
- maxTotalSockets?: number | undefined;
1244
- /**
1245
- * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256.
1246
- */
1247
- maxFreeSockets?: number | undefined;
1248
- /**
1249
- * Socket timeout in milliseconds. This will set the timeout after the socket is connected.
1250
- */
1251
- timeout?: number | undefined;
1252
- /**
1253
- * Scheduling strategy to apply when picking the next free socket to use.
1254
- * @default `lifo`
1255
- */
1256
- scheduling?: 'fifo' | 'lifo' | undefined;
1257
- }
1258
- /**
1259
- * An `Agent` is responsible for managing connection persistence
1260
- * and reuse for HTTP clients. It maintains a queue of pending requests
1261
- * for a given host and port, reusing a single socket connection for each
1262
- * until the queue is empty, at which time the socket is either destroyed
1263
- * or put into a pool where it is kept to be used again for requests to the
1264
- * same host and port. Whether it is destroyed or pooled depends on the`keepAlive` `option`.
1265
- *
1266
- * Pooled connections have TCP Keep-Alive enabled for them, but servers may
1267
- * still close idle connections, in which case they will be removed from the
1268
- * pool and a new connection will be made when a new HTTP request is made for
1269
- * that host and port. Servers may also refuse to allow multiple requests
1270
- * over the same connection, in which case the connection will have to be
1271
- * remade for every request and cannot be pooled. The `Agent` will still make
1272
- * the requests to that server, but each one will occur over a new connection.
1273
- *
1274
- * When a connection is closed by the client or the server, it is removed
1275
- * from the pool. Any unused sockets in the pool will be unrefed so as not
1276
- * to keep the Node.js process running when there are no outstanding requests.
1277
- * (see `socket.unref()`).
1278
- *
1279
- * It is good practice, to `destroy()` an `Agent` instance when it is no
1280
- * longer in use, because unused sockets consume OS resources.
1281
- *
1282
- * Sockets are removed from an agent when the socket emits either
1283
- * a `'close'` event or an `'agentRemove'` event. When intending to keep one
1284
- * HTTP request open for a long time without keeping it in the agent, something
1285
- * like the following may be done:
1286
- *
1287
- * ```js
1288
- * http.get(options, (res) => {
1289
- * // Do stuff
1290
- * }).on('socket', (socket) => {
1291
- * socket.emit('agentRemove');
1292
- * });
1293
- * ```
1294
- *
1295
- * 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
1296
- * will be used
1297
- * for the client connection.
1298
- *
1299
- * `agent:false`:
1300
- *
1301
- * ```js
1302
- * http.get({
1303
- * hostname: 'localhost',
1304
- * port: 80,
1305
- * path: '/',
1306
- * agent: false, // Create a new agent just for this one request
1307
- * }, (res) => {
1308
- * // Do stuff with response
1309
- * });
1310
- * ```
1311
- * @since v0.3.4
1312
- */
1313
- class Agent {
1314
- /**
1315
- * By default set to 256\. For agents with `keepAlive` enabled, this
1316
- * sets the maximum number of sockets that will be left open in the free
1317
- * state.
1318
- * @since v0.11.7
1319
- */
1320
- maxFreeSockets: number;
1321
- /**
1322
- * By default set to `Infinity`. Determines how many concurrent sockets the agent
1323
- * can have open per origin. Origin is the returned value of `agent.getName()`.
1324
- * @since v0.3.6
1325
- */
1326
- maxSockets: number;
1327
- /**
1328
- * By default set to `Infinity`. Determines how many concurrent sockets the agent
1329
- * can have open. Unlike `maxSockets`, this parameter applies across all origins.
1330
- * @since v14.5.0, v12.19.0
1331
- */
1332
- maxTotalSockets: number;
1333
- /**
1334
- * An object which contains arrays of sockets currently awaiting use by
1335
- * the agent when `keepAlive` is enabled. Do not modify.
1336
- *
1337
- * Sockets in the `freeSockets` list will be automatically destroyed and
1338
- * removed from the array on `'timeout'`.
1339
- * @since v0.11.4
1340
- */
1341
- readonly freeSockets: NodeJS.ReadOnlyDict<Socket[]>;
1342
- /**
1343
- * An object which contains arrays of sockets currently in use by the
1344
- * agent. Do not modify.
1345
- * @since v0.3.6
1346
- */
1347
- readonly sockets: NodeJS.ReadOnlyDict<Socket[]>;
1348
- /**
1349
- * An object which contains queues of requests that have not yet been assigned to
1350
- * sockets. Do not modify.
1351
- * @since v0.5.9
1352
- */
1353
- readonly requests: NodeJS.ReadOnlyDict<IncomingMessage[]>;
1354
- constructor(opts?: AgentOptions);
1355
- /**
1356
- * Destroy any sockets that are currently in use by the agent.
1357
- *
1358
- * It is usually not necessary to do this. However, if using an
1359
- * agent with `keepAlive` enabled, then it is best to explicitly shut down
1360
- * the agent when it is no longer needed. Otherwise,
1361
- * sockets might stay open for quite a long time before the server
1362
- * terminates them.
1363
- * @since v0.11.4
1364
- */
1365
- destroy(): void;
1366
- }
1367
- const METHODS: string[];
1368
- const STATUS_CODES: {
1369
- [errorCode: number]: string | undefined;
1370
- [errorCode: string]: string | undefined;
1371
- };
1372
- /**
1373
- * Returns a new instance of {@link Server}.
1374
- *
1375
- * The `requestListener` is a function which is automatically
1376
- * added to the `'request'` event.
1377
- * @since v0.1.13
1378
- */
1379
- function createServer<
1380
- Request extends typeof IncomingMessage = typeof IncomingMessage,
1381
- Response extends typeof ServerResponse = typeof ServerResponse,
1382
- >(requestListener?: RequestListener<Request, Response>): Server<Request, Response>;
1383
- function createServer<
1384
- Request extends typeof IncomingMessage = typeof IncomingMessage,
1385
- Response extends typeof ServerResponse = typeof ServerResponse,
1386
- >(
1387
- options: ServerOptions<Request, Response>,
1388
- requestListener?: RequestListener<Request, Response>,
1389
- ): Server<Request, Response>;
1390
- // although RequestOptions are passed as ClientRequestArgs to ClientRequest directly,
1391
- // create interface RequestOptions would make the naming more clear to developers
1392
- interface RequestOptions extends ClientRequestArgs {}
1393
- /**
1394
- * `options` in `socket.connect()` are also supported.
1395
- *
1396
- * Node.js maintains several connections per server to make HTTP requests.
1397
- * This function allows one to transparently issue requests.
1398
- *
1399
- * `url` can be a string or a `URL` object. If `url` is a
1400
- * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
1401
- *
1402
- * If both `url` and `options` are specified, the objects are merged, with the`options` properties taking precedence.
1403
- *
1404
- * The optional `callback` parameter will be added as a one-time listener for
1405
- * the `'response'` event.
1406
- *
1407
- * `http.request()` returns an instance of the {@link ClientRequest} class. The `ClientRequest` instance is a writable stream. If one needs to
1408
- * upload a file with a POST request, then write to the `ClientRequest` object.
1409
- *
1410
- * ```js
1411
- * const http = require('node:http');
1412
- *
1413
- * const postData = JSON.stringify({
1414
- * 'msg': 'Hello World!',
1415
- * });
1416
- *
1417
- * const options = {
1418
- * hostname: 'www.google.com',
1419
- * port: 80,
1420
- * path: '/upload',
1421
- * method: 'POST',
1422
- * headers: {
1423
- * 'Content-Type': 'application/json',
1424
- * 'Content-Length': Buffer.byteLength(postData),
1425
- * },
1426
- * };
1427
- *
1428
- * const req = http.request(options, (res) => {
1429
- * console.log(`STATUS: ${res.statusCode}`);
1430
- * console.log(`HEADERS: ${JSON.stringify(res.headers)}`);
1431
- * res.setEncoding('utf8');
1432
- * res.on('data', (chunk) => {
1433
- * console.log(`BODY: ${chunk}`);
1434
- * });
1435
- * res.on('end', () => {
1436
- * console.log('No more data in response.');
1437
- * });
1438
- * });
1439
- *
1440
- * req.on('error', (e) => {
1441
- * console.error(`problem with request: ${e.message}`);
1442
- * });
1443
- *
1444
- * // Write data to request body
1445
- * req.write(postData);
1446
- * req.end();
1447
- * ```
1448
- *
1449
- * In the example `req.end()` was called. With `http.request()` one
1450
- * must always call `req.end()` to signify the end of the request -
1451
- * even if there is no data being written to the request body.
1452
- *
1453
- * If any error is encountered during the request (be that with DNS resolution,
1454
- * TCP level errors, or actual HTTP parse errors) an `'error'` event is emitted
1455
- * on the returned request object. As with all `'error'` events, if no listeners
1456
- * are registered the error will be thrown.
1457
- *
1458
- * There are a few special headers that should be noted.
1459
- *
1460
- * * Sending a 'Connection: keep-alive' will notify Node.js that the connection to
1461
- * the server should be persisted until the next request.
1462
- * * Sending a 'Content-Length' header will disable the default chunked encoding.
1463
- * * Sending an 'Expect' header will immediately send the request headers.
1464
- * Usually, when sending 'Expect: 100-continue', both a timeout and a listener
1465
- * for the `'continue'` event should be set. See RFC 2616 Section 8.2.3 for more
1466
- * information.
1467
- * * Sending an Authorization header will override using the `auth` option
1468
- * to compute basic authentication.
1469
- *
1470
- * Example using a `URL` as `options`:
1471
- *
1472
- * ```js
1473
- * const options = new URL('http://abc:xyz@example.com');
1474
- *
1475
- * const req = http.request(options, (res) => {
1476
- * // ...
1477
- * });
1478
- * ```
1479
- *
1480
- * In a successful request, the following events will be emitted in the following
1481
- * order:
1482
- *
1483
- * * `'socket'`
1484
- * * `'response'`
1485
- * * `'data'` any number of times, on the `res` object
1486
- * (`'data'` will not be emitted at all if the response body is empty, for
1487
- * instance, in most redirects)
1488
- * * `'end'` on the `res` object
1489
- * * `'close'`
1490
- *
1491
- * In the case of a connection error, the following events will be emitted:
1492
- *
1493
- * * `'socket'`
1494
- * * `'error'`
1495
- * * `'close'`
1496
- *
1497
- * In the case of a premature connection close before the response is received,
1498
- * the following events will be emitted in the following order:
1499
- *
1500
- * * `'socket'`
1501
- * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`
1502
- * * `'close'`
1503
- *
1504
- * In the case of a premature connection close after the response is received,
1505
- * the following events will be emitted in the following order:
1506
- *
1507
- * * `'socket'`
1508
- * * `'response'`
1509
- * * `'data'` any number of times, on the `res` object
1510
- * * (connection closed here)
1511
- * * `'aborted'` on the `res` object
1512
- * * `'error'` on the `res` object with an error with message`'Error: aborted'` and code `'ECONNRESET'`
1513
- * * `'close'`
1514
- * * `'close'` on the `res` object
1515
- *
1516
- * If `req.destroy()` is called before a socket is assigned, the following
1517
- * events will be emitted in the following order:
1518
- *
1519
- * * (`req.destroy()` called here)
1520
- * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`, or the error with which `req.destroy()` was called
1521
- * * `'close'`
1522
- *
1523
- * If `req.destroy()` is called before the connection succeeds, the following
1524
- * events will be emitted in the following order:
1525
- *
1526
- * * `'socket'`
1527
- * * (`req.destroy()` called here)
1528
- * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`, or the error with which `req.destroy()` was called
1529
- * * `'close'`
1530
- *
1531
- * If `req.destroy()` is called after the response is received, the following
1532
- * events will be emitted in the following order:
1533
- *
1534
- * * `'socket'`
1535
- * * `'response'`
1536
- * * `'data'` any number of times, on the `res` object
1537
- * * (`req.destroy()` called here)
1538
- * * `'aborted'` on the `res` object
1539
- * * `'error'` on the `res` object with an error with message `'Error: aborted'`and code `'ECONNRESET'`, or the error with which `req.destroy()` was called
1540
- * * `'close'`
1541
- * * `'close'` on the `res` object
1542
- *
1543
- * If `req.abort()` is called before a socket is assigned, the following
1544
- * events will be emitted in the following order:
1545
- *
1546
- * * (`req.abort()` called here)
1547
- * * `'abort'`
1548
- * * `'close'`
1549
- *
1550
- * If `req.abort()` is called before the connection succeeds, the following
1551
- * events will be emitted in the following order:
1552
- *
1553
- * * `'socket'`
1554
- * * (`req.abort()` called here)
1555
- * * `'abort'`
1556
- * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`
1557
- * * `'close'`
1558
- *
1559
- * If `req.abort()` is called after the response is received, the following
1560
- * events will be emitted in the following order:
1561
- *
1562
- * * `'socket'`
1563
- * * `'response'`
1564
- * * `'data'` any number of times, on the `res` object
1565
- * * (`req.abort()` called here)
1566
- * * `'abort'`
1567
- * * `'aborted'` on the `res` object
1568
- * * `'error'` on the `res` object with an error with message`'Error: aborted'` and code `'ECONNRESET'`.
1569
- * * `'close'`
1570
- * * `'close'` on the `res` object
1571
- *
1572
- * Setting the `timeout` option or using the `setTimeout()` function will
1573
- * not abort the request or do anything besides add a `'timeout'` event.
1574
- *
1575
- * Passing an `AbortSignal` and then calling `abort()` on the corresponding`AbortController` will behave the same way as calling `.destroy()` on the
1576
- * request. Specifically, the `'error'` event will be emitted with an error with
1577
- * the message `'AbortError: The operation was aborted'`, the code `'ABORT_ERR'`and the `cause`, if one was provided.
1578
- * @since v0.3.6
1579
- */
1580
- function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
1581
- function request(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
1582
- /**
1583
- * Since most requests are GET requests without bodies, Node.js provides this
1584
- * 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
1585
- * response
1586
- * data for reasons stated in {@link ClientRequest} section.
1587
- *
1588
- * The `callback` is invoked with a single argument that is an instance of {@link IncomingMessage}.
1589
- *
1590
- * JSON fetching example:
1591
- *
1592
- * ```js
1593
- * http.get('http://localhost:8000/', (res) => {
1594
- * const { statusCode } = res;
1595
- * const contentType = res.headers['content-type'];
1596
- *
1597
- * let error;
1598
- * // Any 2xx status code signals a successful response but
1599
- * // here we're only checking for 200.
1600
- * if (statusCode !== 200) {
1601
- * error = new Error('Request Failed.\n' +
1602
- * `Status Code: ${statusCode}`);
1603
- * } else if (!/^application\/json/.test(contentType)) {
1604
- * error = new Error('Invalid content-type.\n' +
1605
- * `Expected application/json but received ${contentType}`);
1606
- * }
1607
- * if (error) {
1608
- * console.error(error.message);
1609
- * // Consume response data to free up memory
1610
- * res.resume();
1611
- * return;
1612
- * }
1613
- *
1614
- * res.setEncoding('utf8');
1615
- * let rawData = '';
1616
- * res.on('data', (chunk) => { rawData += chunk; });
1617
- * res.on('end', () => {
1618
- * try {
1619
- * const parsedData = JSON.parse(rawData);
1620
- * console.log(parsedData);
1621
- * } catch (e) {
1622
- * console.error(e.message);
1623
- * }
1624
- * });
1625
- * }).on('error', (e) => {
1626
- * console.error(`Got error: ${e.message}`);
1627
- * });
1628
- *
1629
- * // Create a local server to receive data from
1630
- * const server = http.createServer((req, res) => {
1631
- * res.writeHead(200, { 'Content-Type': 'application/json' });
1632
- * res.end(JSON.stringify({
1633
- * data: 'Hello World!',
1634
- * }));
1635
- * });
1636
- *
1637
- * server.listen(8000);
1638
- * ```
1639
- * @since v0.3.6
1640
- * @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.
1641
- */
1642
- function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
1643
- function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
1644
- /**
1645
- * Performs the low-level validations on the provided `name` that are done when`res.setHeader(name, value)` is called.
1646
- *
1647
- * Passing illegal value as `name` will result in a `TypeError` being thrown,
1648
- * identified by `code: 'ERR_INVALID_HTTP_TOKEN'`.
1649
- *
1650
- * It is not necessary to use this method before passing headers to an HTTP request
1651
- * or response. The HTTP module will automatically validate such headers.
1652
- * Examples:
1653
- *
1654
- * Example:
1655
- *
1656
- * ```js
1657
- * const { validateHeaderName } = require('node:http');
1658
- *
1659
- * try {
1660
- * validateHeaderName('');
1661
- * } catch (err) {
1662
- * console.error(err instanceof TypeError); // --> true
1663
- * console.error(err.code); // --> 'ERR_INVALID_HTTP_TOKEN'
1664
- * console.error(err.message); // --> 'Header name must be a valid HTTP token [""]'
1665
- * }
1666
- * ```
1667
- * @since v14.3.0
1668
- * @param [label='Header name'] Label for error message.
1669
- */
1670
- function validateHeaderName(name: string): void;
1671
- /**
1672
- * Performs the low-level validations on the provided `value` that are done when`res.setHeader(name, value)` is called.
1673
- *
1674
- * Passing illegal value as `value` will result in a `TypeError` being thrown.
1675
- *
1676
- * * Undefined value error is identified by `code: 'ERR_HTTP_INVALID_HEADER_VALUE'`.
1677
- * * Invalid value character error is identified by `code: 'ERR_INVALID_CHAR'`.
1678
- *
1679
- * It is not necessary to use this method before passing headers to an HTTP request
1680
- * or response. The HTTP module will automatically validate such headers.
1681
- *
1682
- * Examples:
1683
- *
1684
- * ```js
1685
- * const { validateHeaderValue } = require('node:http');
1686
- *
1687
- * try {
1688
- * validateHeaderValue('x-my-header', undefined);
1689
- * } catch (err) {
1690
- * console.error(err instanceof TypeError); // --> true
1691
- * console.error(err.code === 'ERR_HTTP_INVALID_HEADER_VALUE'); // --> true
1692
- * console.error(err.message); // --> 'Invalid value "undefined" for header "x-my-header"'
1693
- * }
1694
- *
1695
- * try {
1696
- * validateHeaderValue('x-my-header', 'oʊmɪɡə');
1697
- * } catch (err) {
1698
- * console.error(err instanceof TypeError); // --> true
1699
- * console.error(err.code === 'ERR_INVALID_CHAR'); // --> true
1700
- * console.error(err.message); // --> 'Invalid character in header content ["x-my-header"]'
1701
- * }
1702
- * ```
1703
- * @since v14.3.0
1704
- * @param name Header name
1705
- * @param value Header value
1706
- */
1707
- function validateHeaderValue(name: string, value: string): void;
1708
- /**
1709
- * Set the maximum number of idle HTTP parsers.
1710
- * @since v18.8.0, v16.18.0
1711
- * @param [max=1000]
1712
- */
1713
- function setMaxIdleHTTPParsers(max: number): void;
1714
- let globalAgent: Agent;
1715
- /**
1716
- * Read-only property specifying the maximum allowed size of HTTP headers in bytes.
1717
- * Defaults to 16KB. Configurable using the `--max-http-header-size` CLI option.
1718
- */
1719
- const maxHeaderSize: number;
1720
- }
1721
- declare module 'node:http' {
1722
- export * from 'http';
1723
- }