From 6e5017ad0ff13423612d91ac59086025d6424b26 Mon Sep 17 00:00:00 2001 From: "fj.jin" Date: Sun, 15 Nov 2020 01:40:57 +0800 Subject: [PATCH] make it clear that the context will be reset after the request ends. --- gin.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gin.go b/gin.go index 1e126179..07315170 100644 --- a/gin.go +++ b/gin.go @@ -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) }