net/http: document that ParseForm consumes Request.Body #35620
Labels
Documentation
FrozenDueToAge
help wanted
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
What version of Go are you using (
go version
)?go version go1.11.13 darwin/amd64
but looking at the code, it's clear the bug exists in master
Does this issue reproduce with the latest release?
yes it would
What operating system and processor architecture are you using (
go env
)?Irrelevant. Looking at net/http/request.go we can see the bug. In
parsePostForm()
, the body of thehttp.Request
is read but not restored. Therefore one cannot read from the request body again after calling this API, which either is intentional in which case it's a documentation bug as the comment on the function does not indicate callers should not call this unless they're done with the body, or it's not intentional in which case it's a functional bug.One should be able to call
ParseForm()
and still read the body of anhttp.Request
later.What did you do?
What did you expect to see?
I expected the first test to fail.
What did you see instead?
The first test passed, showing there's a bug.
The text was updated successfully, but these errors were encountered: