You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue is that method ParseFrom of *net.http.Request returns an error when the body of the request is not nil.
What did you expect to see?
I expect to see that the error is equal to nil.
As far as I understand, the issue stems from the fact that the body of a server POST request is always non-nil. However, it is possible to create a valid client POST request with nil body. The documentation of the method https://godoc.org/net/http#Request.ParseForm does not distinguish between a server and a client POST request. Therefore, it seems reasonable to assume that invoking the method on any valid request will not produce an error.
Therefore, it looks as it would make sense to adjust the documentation. The more general approach would be to change line https://golang.org/src/net/http/request.go#L1131 and do not return an error if the body is nil.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, it does.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://play.golang.org/p/JO2CILHKDEQ
The issue is that method
ParseFrom
of*net.http.Request
returns an error when the body of the request is not nil.What did you expect to see?
I expect to see that the error is equal to nil.
As far as I understand, the issue stems from the fact that the body of a server POST request is always non-nil. However, it is possible to create a valid client POST request with nil body. The documentation of the method https://godoc.org/net/http#Request.ParseForm does not distinguish between a server and a client POST request. Therefore, it seems reasonable to assume that invoking the method on any valid request will not produce an error.
Therefore, it looks as it would make sense to adjust the documentation. The more general approach would be to change line https://golang.org/src/net/http/request.go#L1131 and do not return an error if the body is nil.
This issue was mentioned here: https://go-review.googlesource.com/c/go/+/48890/ which is now frozen. The last reply was:
I can prepare a draft.
What did you see instead?
I see a non-nil error:
missing form body
.The text was updated successfully, but these errors were encountered: