Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: respect --max-http-header-size Node.js flag #2234

Prev Previous commit
Next Next commit
add test under test/fetch
  • Loading branch information
balazsorban44 committed Sep 5, 2023
commit 417ef095ebe0f364fc2905098d430f9213821b2b
24 changes: 24 additions & 0 deletions test/fetch/client-node-max-header-size.js
Original file line number Diff line number Diff line change
@@ -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) => {

Check failure on line 8 in test/fetch/client-node-max-header-size.js

View workflow job for this annotation

GitHub Actions / lint

Block must not be padded by blank lines


Check failure on line 10 in test/fetch/client-node-max-header-size.js

View workflow job for this annotation

GitHub Actions / lint

More than 1 blank line not allowed
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()
})
Loading