Update gin.go

if  use HandleContext  ,c.index is new index .if use old ,same func  well be run reduplicate
This commit is contained in:
moonpanda 2019-06-11 10:35:08 +08:00 committed by GitHub
parent 73c4633943
commit 5edb93d553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

3
gin.go
View File

@ -358,11 +358,8 @@ func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request) {
// This can be done by setting c.Request.URL.Path to your new target.
// Disclaimer: You can loop yourself to death with this, use wisely.
func (engine *Engine) HandleContext(c *Context) {
oldIndexValue := c.index
c.reset()
engine.handleHTTPRequest(c)
c.index = oldIndexValue
}
func (engine *Engine) handleHTTPRequest(c *Context) {