1
0
mirror of https://github.com/labstack/echo.git synced 2025-04-17 12:06:44 +02:00

Reset Echo in Response#reset()

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2015-12-02 08:07:22 -08:00
parent f448379651
commit 2483d2a140
3 changed files with 4 additions and 3 deletions

View File

@ -262,7 +262,7 @@ func (c *Context) Echo() *Echo {
func (c *Context) reset(r *http.Request, w http.ResponseWriter, e *Echo) {
c.request = r
c.response.reset(w)
c.response.reset(w, e)
c.query = nil
c.store = nil
c.echo = e

View File

@ -75,9 +75,10 @@ func (r *Response) Committed() bool {
return r.committed
}
func (r *Response) reset(w http.ResponseWriter) {
func (r *Response) reset(w http.ResponseWriter, e *Echo) {
r.writer = w
r.size = 0
r.status = http.StatusOK
r.committed = false
r.echo = e
}

View File

@ -62,5 +62,5 @@ func TestResponse(t *testing.T) {
})
// reset
r.reset(httptest.NewRecorder())
r.reset(httptest.NewRecorder(), New())
}