mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-16 13:22:09 +08:00
Update context.go
This commit is contained in:
parent
bc2417fc40
commit
35c8f99bb4
@ -415,7 +415,7 @@ func (c *Context) Query(key string) (value string) {
|
|||||||
// c.DefaultQuery("name", "unknown") == "Manu"
|
// c.DefaultQuery("name", "unknown") == "Manu"
|
||||||
// c.DefaultQuery("id", "none") == "none"
|
// c.DefaultQuery("id", "none") == "none"
|
||||||
// c.DefaultQuery("lastname", "none") == ""
|
// c.DefaultQuery("lastname", "none") == ""
|
||||||
func (c *Context) DefaultQuery(key, defaultValue string) string {
|
func (c *Context) DefaultQuery(key, defaultValue interface{}) interface{} {
|
||||||
if value, ok := c.GetQuery(key); ok {
|
if value, ok := c.GetQuery(key); ok {
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user