summaryrefslogtreecommitdiff
path: root/vendor/github.com/gin-gonic/gin/test_helpers.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/gin-gonic/gin/test_helpers.go')
-rw-r--r--vendor/github.com/gin-gonic/gin/test_helpers.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/vendor/github.com/gin-gonic/gin/test_helpers.go b/vendor/github.com/gin-gonic/gin/test_helpers.go
index b3be93b4e..7508c5c90 100644
--- a/vendor/github.com/gin-gonic/gin/test_helpers.go
+++ b/vendor/github.com/gin-gonic/gin/test_helpers.go
@@ -9,7 +9,15 @@ import "net/http"
// CreateTestContext returns a fresh engine and context for testing purposes
func CreateTestContext(w http.ResponseWriter) (c *Context, r *Engine) {
r = New()
- c = r.allocateContext()
+ c = r.allocateContext(0)
+ c.reset()
+ c.writermem.reset(w)
+ return
+}
+
+// CreateTestContextOnly returns a fresh context base on the engine for testing purposes
+func CreateTestContextOnly(w http.ResponseWriter, r *Engine) (c *Context) {
+ c = r.allocateContext(r.maxParams)
c.reset()
c.writermem.reset(w)
return