Skip to content

Commit

Permalink
net/http: document that FormValue returns the empty string
Browse files Browse the repository at this point in the history
Fixes #8137

Change-Id: Icd94bbe430a3ef333248425449b5fc678edb0343
Reviewed-on: https://go-review.googlesource.com/11410
Reviewed-by: Andrew Gerrand <adg@golang.org>
  • Loading branch information
bradfitz committed Jun 25, 2015
1 parent 33ce9c1 commit 2917ab2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/net/http/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,7 @@ func (r *Request) ParseMultipartForm(maxMemory int64) error {
// POST and PUT body parameters take precedence over URL query string values.
// 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.
// To access multiple values of the same key, call ParseForm and
// then inspect Request.Form directly.
func (r *Request) FormValue(key string) string {
Expand All @@ -894,6 +895,7 @@ func (r *Request) FormValue(key string) string {
// or PUT request body. URL query parameters are ignored.
// PostFormValue calls ParseMultipartForm and ParseForm if necessary and ignores
// any errors returned by these functions.
// If key is not present, PostFormValue returns the empty string.
func (r *Request) PostFormValue(key string) string {
if r.PostForm == nil {
r.ParseMultipartForm(defaultMaxMemory)
Expand Down

0 comments on commit 2917ab2

Please sign in to comment.