Add c.PostFormExists(key) method which returns true if field with given name exists in the form

This commit is contained in:
Roman Minkin 2015-10-09 17:17:16 -04:00
parent 52fcc5dbf6
commit 2382eed21d

View File

@ -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)