diff --git a/context.go b/context.go index e45e977..e7bd0f5 100644 --- a/context.go +++ b/context.go @@ -116,3 +116,12 @@ func (c *Context) Redirect(url string) { func (c *Context) QueryValue(key string) string { return c.r.URL.Query().Get(key) } + +func (c *Context) QueryValueWithDefault(key string, def string) string { + val := c.r.URL.Query().Get(key) + if val == "" { + return def + } + return val +} +