httputil.DumpRequestOut does not currently print anything w.r.t. Transfer-Encoding (TE) even though the information is printed via DumpRequest. In addition, there is special logic for handling TE that seems like maybe it hasn't been extracted out so the logic is hard-coded into DumpRequest which means that it could drift from what is actually done when sending the request.
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 DumpRequest is for server side debugging whereas DumpRequestOut is for clientside, but I'm not familiar with why they couldn't/shouldn't be more similar (or the same).
Not sure if this logic should be put into DumpRequestOut, if not, why? And I'd like to get a bit of feedback if this is a known issue that maintainers would like to have cleaned up.
What version of Go are you using (go version)?
Go playground, any go version as far as I'm aware.
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env)?
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.
its a type of request that normally might have a body (POST, PUT, etc
content length was set to < 0
we do not set any TransferEncoding value
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?