mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-16 13:22:09 +08:00
Merge aba8867fc541410f5c6e1ebdd12c74c680a5d721 into 52fcc5dbf6e94df33ad313858fb94b713e9d1b4a
This commit is contained in:
commit
4906da1f7c
@ -212,11 +212,9 @@ func (c *Context) DefaultPostForm(key, defaultValue string) string {
|
|||||||
|
|
||||||
// DefaultQuery returns the keyed url query value if it exists, othewise it returns the
|
// DefaultQuery returns the keyed url query value if it exists, othewise it returns the
|
||||||
// specified defaultValue.
|
// specified defaultValue.
|
||||||
// ```
|
|
||||||
// /?name=Manu
|
// /?name=Manu
|
||||||
// c.DefaultQuery("name", "unknown") == "Manu"
|
// c.DefaultQuery("name", "unknown") == "Manu"
|
||||||
// c.DefaultQuery("id", "none") == "none"
|
// c.DefaultQuery("id", "none") == "none"
|
||||||
// ```
|
|
||||||
func (c *Context) DefaultQuery(key, defaultValue string) string {
|
func (c *Context) DefaultQuery(key, defaultValue string) string {
|
||||||
if va, ok := c.query(key); ok {
|
if va, ok := c.query(key); ok {
|
||||||
return va
|
return va
|
||||||
|
Loading…
x
Reference in New Issue
Block a user