mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-15 21:06:39 +08:00
16 lines
316 B
Go
16 lines
316 B
Go
// 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
|
|
}
|