Prevent panic in Context.GetQuery() when there is no Request (#2412)
Co-authored-by: thinkerou <thinkerou@gmail.com>
This commit is contained in:
+5
-1
@@ -416,7 +416,11 @@ func (c *Context) QueryArray(key string) []string {
|
||||
|
||||
func (c *Context) initQueryCache() {
|
||||
if c.queryCache == nil {
|
||||
c.queryCache = c.Request.URL.Query()
|
||||
if c.Request != nil {
|
||||
c.queryCache = c.Request.URL.Query()
|
||||
} else {
|
||||
c.queryCache = url.Values{}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user