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
I suggest renaming the PostForm field to something like BodyForm, and the PostFormValue function to something like BodyFormValue — the point being that the data is coming from the request body, not form the URI.
(A fix can involve simply adding a BodyFormValue to the Request type and deprecating PostFormValue, and something similar can be done with the PostForm field.)
The text was updated successfully, but these errors were encountered:
Aside from this being something for Go2 (we don't want "deprecating" + adding api which adds clutter), I don't see anything wrong with this proposal.
Tagging dislikers (@cznic, @wardenlym, @ucirello) to see if I missing anything. Maybe y'all don't think this change is enough - overhaul of form api? (Maybe you think Parse*Form methods aren't full featured enough or should return the form instead of parse into other fields.) But that would be a separate proposal.
This also explains why the doc comment for PostFormValue is wrong: form values sent with the POST method are now also included.
nit: POST is included in that doc - I assume you mean PATCH is missing.
@meirf thank you. You’re right, I meant to say that PostFormValue also returns values from PATCH requests. I too don’t understand the downvotes, since the proposal intends only to clean up the API (to make it less confusing) in accordance with changes that have been made to the Request type.
It looks like the PostForm field and the PostFormValue method of the http.Request struct were at first intended only for the form body of a POST request, as is obvious from the names (and this: https://sourcegraph.com/github.com/golang/go/-/commit/abb3c0618b658a41bf91a087f1737412e93ff6d9). Later on, PATCH requests were included along with POST and PUT requests to be dealt with the same way.
This also explains why the doc comment for PostFormValue (https://godoc.org/net/http#Request.PostFormValue) is wrong: form values sent with the PATCH method are now also included.
I suggest renaming the
PostForm
field to something likeBodyForm
, and thePostFormValue
function to something likeBodyFormValue
— the point being that the data is coming from the request body, not form the URI.(A fix can involve simply adding a
BodyFormValue
to the Request type and deprecatingPostFormValue
, and something similar can be done with thePostForm
field.)The text was updated successfully, but these errors were encountered: