1
0
mirror of https://github.com/golang/go synced 2024-11-17 02:34:46 -07:00

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

Fixes #64575
This commit is contained in:
Jes Cok 2024-01-09 13:29:43 +08:00
parent b7c630dc3a
commit 17aa5170cb

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.