3 ms·
Wait, are the headers canonicalized if you retrieve them from r.Header where r is a request? I mean, if the safest is to conform to the html spec, there should
by aatd86 3y ago
Wait, are the headers canonicalized if you retrieve them from r.Header where r is a request?
I mean, if the safest is to conform to the html spec, there should be an escape hatch for the rarer cases easier than going all the way to the tcp level?
- opportune 3y agoIt's been a while since I battled this but IIRC, you can set unconcalized headers on requests you serialize yourself (for egress) with a simple workaround (directly add the header to the request's header map rather than the setter function) but if you use Go's default http handler libraries, it "helpfully" canonicalizes headers for you when it deserializes incoming requests and then invokes your http handler. So you are unable to access to the original casing that way, unless you instead use a TCP server.