From 89988e183aa11ac3225e2050416c093b57c17026 Mon Sep 17 00:00:00 2001 From: Robert-XIAO-777 <135826823+Robert-XIAO-777@users.noreply.github.com> Date: Wed, 7 Jun 2023 18:30:02 +0800 Subject: [PATCH] fix re-enter middleware bug --- gin.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gin.go b/gin.go index ed8b6dad75..2b05b71d6a 100644 --- a/gin.go +++ b/gin.go @@ -583,10 +583,12 @@ func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request) { // Disclaimer: You can loop yourself to deal with this, use wisely. func (engine *Engine) HandleContext(c *Context) { oldIndexValue := c.index + oldHandles := c.handlers c.reset() engine.handleHTTPRequest(c) c.index = oldIndexValue + c.handlers = oldHandles } func (engine *Engine) handleHTTPRequest(c *Context) {