No verbatim headers possible #51
-
It's not possible to have non-canonical headers with current Api. I'd suggest to add |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
In theory, it shouldn't matter but in practice, some servers suck. I had this problem when I was using Ruby to talk to some government server back in 2016, so I'm definitely sympathetic to the issue. I hate to junk up the main interface for what's really a workaround for the server sucking. Maybe a custom transport? In most cases, I guess you probably just need all lowercase or something, so maybe just write LowercaseHeaders := requests.RoundTripFunc(func(req *http.Request) (res *http.Response, err error) {
req2 := *req
req2.Header = make(http.Header, len(req.Header))
for k, v := range req.Header {
req2.Header[strings.ToLower(k)] = v
}
return http.DefaultTransport.RoundTrip(&req2)
})
rb := requests.
URL("https://example.com").
Transport(LowercaseHeaders) Will that work for you? |
Beta Was this translation helpful? Give feedback.
In theory, it shouldn't matter but in practice, some servers suck. I had this problem when I was using Ruby to talk to some government server back in 2016, so I'm definitely sympathetic to the issue.
I hate to junk up the main interface for what's really a workaround for the server sucking. Maybe a custom transport? In most cases, I guess you probably just need all lowercase or something, so maybe just write