Update gin.go

the param is not empty in router.
This commit is contained in:
codeHauler-1 2021-12-04 20:44:36 +08:00 committed by GitHub
parent 678aaadcd5
commit bab4425698
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

8
gin.go
View File

@ -529,6 +529,14 @@ func (engine *Engine) handleHTTPRequest(c *Context) {
root := t[i].root
// Find route in tree
value := root.getValue(rPath, c.params, unescape)
for _, param := range *value.params {
if len(param.Value) < 1 {
serveError(c, http.StatusNotFound, default404Body)
return
}
}
if value.params != nil {
c.Params = *value.params
}