Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
net/http: client `Expect: 100-continue` reads first byte of input on failure #16002
I'm trying to use
Do do this I'm passing in an
req, err := http.NewRequest("PUT", url, body) // err handling req.Header.Set("Expect", "100-continue")
However what I find is that 1 byte gets read from the reader even if the request fails with a 401 error.
This means that I can't retry the request as 1 byte is now missing from the reader.
It might be that this is working as intended, in which case this behavior should be documented.
What version of Go are you using (
Fails on stable and tip
What operating system and processor architecture are you using (
What did you do?
See https://play.golang.org/p/3jXlWyrgsa for example program
What did you expect to see?
No bytes read from reader on 401 error
What did you see instead?
1 bytes read from the reader