Please describe your feature request:
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.
Please describe your feature request:
Currently,
httpxdoes not support sending multiple custom headers with the same name. When-His 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 tomap[string][]string, similar to Go's standardhttp.Headerimplementation.Additionally,
r.Header.Set()should be replaced withr.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
curlalready support this behavior when multiple-Hflags are provided for the same header. Go's ownhttp.Headertype is also implemented asmap[string][]stringfor this reason.