summaryrefslogtreecommitdiffstats
path: root/test/client-node-max-header-size.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/client-node-max-header-size.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/client-node-max-header-size.js b/test/client-node-max-header-size.js
new file mode 100644
index 0000000..b537490
--- /dev/null
+++ b/test/client-node-max-header-size.js
@@ -0,0 +1,23 @@
+'use strict'
+
+const { execSync } = require('node:child_process')
+const { test } = require('tap')
+
+const command = 'node -e "require(\'.\').request(\'https://httpbin.org/get\')"'
+
+test("respect Node.js' --max-http-header-size", async (t) => {
+ t.throws(
+ // TODO: Drop the `--unhandled-rejections=throw` once we drop Node.js 14
+ () => execSync(`${command} --max-http-header-size=1 --unhandled-rejections=throw`),
+ /UND_ERR_HEADERS_OVERFLOW/,
+ 'max-http-header-size=1 should throw'
+ )
+
+ t.doesNotThrow(
+ () => execSync(command),
+ /UND_ERR_HEADERS_OVERFLOW/,
+ 'default max-http-header-size should not throw'
+ )
+
+ t.end()
+})