diff --git a/test_helpers_test.go b/test_helpers_test.go new file mode 100644 index 00000000..8215e425 --- /dev/null +++ b/test_helpers_test.go @@ -0,0 +1,15 @@ +// This file' name ends with "_test" to avoid pushing "httptest" import on users. +package gin + +import ( + "net/http/httptest" +) + +func CreateTestContext() (c *Context, w *httptest.ResponseRecorder, r *Engine) { + w = httptest.NewRecorder() + r = New() + c = r.allocateContext() + c.reset() + c.writermem.reset(w) + return +}