-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net/http: API provides no way to follow 307 redirect for PUT or POST #7912
Comments
.Net's HttpWebRequest also supports this behavior if AllowAutoRedirect is set. http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.allowautoredirect.aspx |
You can do it by hand with by using http.Transport, which doesn't follow redirects. How would we do this automatically if there's a Request.Body and we get the 307 after we've written the body? Or would this only be in the case where the 307 came in response to a client Expect: 100-continue? |
Sure, this is possible with layers under Client -- but it would be a shame to lose the convenience Client offers. The current interface (where body is an io.Reader) would require a 100-continue step. Given the extra round-trip that shouldn't be the default, so whatever option enables redirecting PUT/POST would also enable 100-continue. Enabling 100-continue independent of redirects could be a useful optimization for some callers but is probably a separate feature request. An optimization where the body is an io.ReadSeeker is also possible, but leads to cases that can only be tested based on runtime type and server responses, which seems fragile. |
Is there any intention of fixing this? Go rewriting The relevant Lines 353 to 355 in 339cf98
|
@juliusv, I know where the code is but there is no proposal on how to fix this yet. See earlier comments. |
Have there been any further updates on this? Is there a timeline or proposal for fixing this? This bug makes it particularly easy for inexperienced Go developers (such as myself) to write buggy HTTP clients. 😞 |
This was fixed recently. It will be in Go 1.8. On phone now. Will close this later with references to fixes. This bug was a lost duplicate. |
Thank you @bradfitz! This made my day 😁 |
Fixed by CL https://go-review.googlesource.com/29852. @bradfitz I realize you might be tracking/triaging fixed bugs for Go1.8 so I'll let you drop the close hammer on this bug. |
Yup. Thanks! |
by mdriley:
The text was updated successfully, but these errors were encountered: