fix re-enter middleware bug

This commit is contained in:
Robert-XIAO-777 2023-06-07 18:30:02 +08:00 committed by GitHub
parent d4a64265f2
commit 89988e183a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

2
gin.go
View File

@ -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) {