Skip to content

header could be empty string#1551

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

header could be empty string#1551
damiandragowski wants to merge 1 commit intohttp-party:masterfrom
damiandragowski:patch-1

Conversation

@damiandragowski
Copy link
Copy Markdown

@damiandragowski damiandragowski commented Sep 10, 2021

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 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
Copy link
Copy Markdown

pi0 commented Mar 25, 2026

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