mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-15 13:02:14 +08:00
Add c.PostFormExists(key)
method which returns true
if field with given name exists in the form
This commit is contained in:
parent
52fcc5dbf6
commit
2382eed21d
@ -198,6 +198,13 @@ func (c *Context) PostForm(key string) (va string) {
|
||||
return
|
||||
}
|
||||
|
||||
// PostFormExists returns `true` if field with given name exists in the form
|
||||
func (c *Context) PostFormExists(key string) (exists bool) {
|
||||
_, exists = c.postForm(key)
|
||||
|
||||
return exists
|
||||
}
|
||||
|
||||
// Param is a shortcut for c.Params.ByName(key)
|
||||
func (c *Context) Param(key string) string {
|
||||
return c.Params.ByName(key)
|
||||
|
Loading…
x
Reference in New Issue
Block a user