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)
| 622 | // email= --> ("", true) := GetPostForm("email") // set email to "" |
| 623 | // --> ("", false) := GetPostForm("email") // do nothing with email |
| 624 | func (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. |