From bab44256983cab6a928d669c3a458b869722a613 Mon Sep 17 00:00:00 2001 From: codeHauler-1 <50894822+codeHauler-1@users.noreply.github.com> Date: Sat, 4 Dec 2021 20:44:36 +0800 Subject: [PATCH] Update gin.go the param is not empty in router. --- gin.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gin.go b/gin.go index 6ab2be66..874e88f2 100644 --- a/gin.go +++ b/gin.go @@ -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 }