make it clear that the context will be reset after the request ends.

This commit is contained in:
fj.jin 2020-11-15 01:40:57 +08:00
parent 7742ff50e0
commit 6e5017ad0f

3
gin.go
View File

@ -371,10 +371,11 @@ func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request) {
c := engine.pool.Get().(*Context)
c.writermem.reset(w)
c.Request = req
c.reset()
engine.handleHTTPRequest(c)
// Given expectations, make it clear that the context will be reset after the request ends.
c.reset()
engine.pool.Put(c)
}