MCPcopy
hub / github.com/gin-gonic/gin / GetPostForm

Method GetPostForm

context.go:624–629  ·  view source on GitHub ↗

GetPostForm is like PostForm(key). It returns the specified key from a POST urlencoded form or multipart form when it exists `(value, true)` (even when the value is an empty string), otherwise it returns ("", false). For example, during a PATCH request to update the user's email: email=mail@ex

(key string)

Source from the content-addressed store, hash-verified

622// email= --> ("", true) := GetPostForm("email") // set email to ""
623// --> ("", false) := GetPostForm("email") // do nothing with email
624func (c *Context) GetPostForm(key string) (string, bool) {
625 if values, ok := c.GetPostFormArray(key); ok {
626 return values[0], ok
627 }
628 return "", false
629}
630
631// PostFormArray returns a slice of strings for a given form key.
632// The length of the slice depends on the number of params with the given key.

Callers 5

PostFormMethod · 0.95
DefaultPostFormMethod · 0.95
TestContextQueryFunction · 0.80

Calls 1

GetPostFormArrayMethod · 0.95

Tested by 3

TestContextQueryFunction · 0.64