Prevent panic in Context.GetQuery() when there is no Request (#2412)

Co-authored-by: thinkerou <thinkerou@gmail.com>
This commit is contained in:
Florian Polster
2020-08-08 14:32:19 +02:00
committed by GitHub
parent 30b5f7e2d7
commit 815e1ce281
2 changed files with 20 additions and 1 deletions
+5 -1
View File
@@ -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{}
}
}
}