net/http: clarify the precedence order for Request.FormValue

Fixes #64575

Change-Id: I0eaec642a9dc8ae3b273a6d41131cc7cb8332947
GitHub-Last-Rev: 17aa5170cb
GitHub-Pull-Request: golang/go#64578
Reviewed-on: https://go-review.googlesource.com/c/go/+/547855
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Jes Cok 2024-01-09 05:33:53 +00:00 committed by Gopher Robot
parent aba18d5b67
commit 59ecebf47f
1 changed files with 5 additions and 1 deletions

View File

@ -1378,7 +1378,11 @@ func (r *Request) ParseMultipartForm(maxMemory int64) error {
}
// FormValue returns the first value for the named component of the query.
// POST, PUT, and PATCH body parameters take precedence over URL query string values.
// The precedence order:
// 1. application/x-www-form-urlencoded form body (POST, PUT, PATCH only)
// 2. query parameters (always)
// 3. multipart/form-data form body (always)
//
// FormValue calls ParseMultipartForm and ParseForm if necessary and ignores
// any errors returned by these functions.
// If key is not present, FormValue returns the empty string.