You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, httpx does not support sending multiple custom headers with the same name. When -H is used multiple times for the same header (for example, -H "Test: 1" -H "Test: 2"), only the last value is preserved.
This happens because custom headers are currently stored using map[string]string, which only allows a single value per header name. To support duplicate headers properly, this should be changed to map[string][]string, similar to Go's standard http.Header implementation.
Additionally, r.Header.Set() should be replaced with r.Header.Add() so that all provided header values are included in the request instead of overwriting previous ones.
Describe the use case of this feature:
The HTTP protocol allows multiple header fields with the same name in certain cases. A common example is Set-Cookie, where multiple separate header entries are expected.
Standard tools like curl already support this behavior when multiple -H flags are provided for the same header. Go's own http.Header type is also implemented as map[string][]string for this reason.
I hit this exact httpx issue last week. The tool maps custom headers to a flat map[string]string right before building the request, which silently drops duplicate keys. Many target servers use duplicate headers to spot automated scrapers during TLS fingerprints or redirect hops. Lose one, you get blocked. Bumping the internal storage type to map[string][]string and calling Go's native http.Header.Add instead of setting keys directly fixes this. It mimics curl cleanly.
Activity
sophymarine commentedon May 25, 2026
I hit this exact httpx issue last week. The tool maps custom headers to a flat
map[string]stringright before building the request, which silently drops duplicate keys. Many target servers use duplicate headers to spot automated scrapers during TLS fingerprints or redirect hops. Lose one, you get blocked. Bumping the internal storage type tomap[string][]stringand calling Go's nativehttp.Header.Addinstead of setting keys directly fixes this. It mimics curl cleanly.dogancanbakir commentedon Jun 3, 2026
@Mzack9999 thoughts?