From 417ef095ebe0f364fc2905098d430f9213821b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Orb=C3=A1n?= Date: Tue, 5 Sep 2023 14:10:16 +0200 Subject: [PATCH] add test under `test/fetch` --- test/fetch/client-node-max-header-size.js | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 test/fetch/client-node-max-header-size.js diff --git a/test/fetch/client-node-max-header-size.js b/test/fetch/client-node-max-header-size.js new file mode 100644 index 00000000000..ece3f860048 --- /dev/null +++ b/test/fetch/client-node-max-header-size.js @@ -0,0 +1,24 @@ +'use strict' + +const { execSync } = require('node:child_process') +const { test } = require('tap') + +const command = 'node -e "require(\'.\').fetch(\'https://httpbin.org/get\')"' + +test("respect Node.js' --max-http-header-size", async (t) => { + + + t.throws( + () => execSync(`${command} --max-http-header-size=1`), + /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() +})