Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
I've not spent too much time looking at possible solutions but the Transfer-Encoding definitely seems to be a special case and its not particularly intuitive whats going on to your request if you set the header field manually or if you set the request.TransferEncoding.
The docs say that
Not sure if this logic should be put into
What version of Go are you using (
So I had thought that this data was being sent since I was able to send the request to a test server, respond with it back, and the TransferEncoding was still set appropriately. However I've now used wireshark to check and it is not actually sent in the request.
https://golang.org/src/net/http/transfer.go?h=writeHeader#L107 seems to show that the
https://play.golang.org/p/pM6PmzpsaX7 is a minimal example which has one line commented out which, if toggled, changes the output.
Transfer encoding set (and only to chunked) when:
That means there is no way to ever actually set any other TransferEncoding and if you try to manually set it to chunked it actually prevents the message from being sent with the chunked transfer encoding.
Is that the intended behavior? I've never actually wanted to change the TE but I was developing a tool to modify/send requests and assumed that someone might need to change that field. Maybe that is just an unnecessary concern?