Skip to content

header could be empty string - #1551

Open
damiandragowski wants to merge 1 commit into
http-party:masterfrom
damiandragowski:patch-1
Open

damiandragowski wants to merge 1 commit into
http-party:masterfrom
damiandragowski:patch-1

Conversation

@damiandragowski

@damiandragowski damiandragowski commented Sep 10, 2021 •

Copy link
Copy Markdown

changing condition, do setHeader only when header is not

null
undefined
NaN
empty string ("")
0
false

It preserve from exception:

[HPM] GET /events?uuids=18cd56cb-45cb-43e6-a397-c4531cc57866 -> http://localhost:8099
_http_outgoing.js:545
throw new ERR_INVALID_HTTP_TOKEN('Header name', name);
^

TypeError [ERR_INVALID_HTTP_TOKEN]: Header name must be a valid HTTP token [""]
at ServerResponse.setHeader (_http_outgoing.js:563:3)

changing condition, do setHeader only when header is not 

null
undefined
NaN
empty string ("")
0
false
@pi0 pi0 mentioned this pull request Sep 1, 2023
21 of 58 tasks
pi0 added a commit to unjs/httpxy that referenced this pull request Mar 25, 2026
…P_TOKEN

add explicit guard for empty/whitespace-only header keys in writeHeaders
(upstream http-party/node-http-proxy#1551)
pi0 added a commit to unjs/httpxy that referenced this pull request Mar 25, 2026
add explicit guard for empty/whitespace-only header keys in writeHeaders
(upstream http-party/node-http-proxy#1551)
@pi0

pi0 commented Mar 25, 2026

Copy link
Copy Markdown

This issue has been fixed in unjs/httpxy#121.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants