mirror of
https://github.com/labstack/echo.git
synced 2024-11-24 08:22:21 +02:00
Response reset size
Set size to 0 when response reset Prevents logged size accumulating with each request
This commit is contained in:
parent
4159cef81e
commit
87b24d3b7e
@ -76,6 +76,7 @@ func (r *Response) Size() int64 {
|
|||||||
|
|
||||||
func (r *Response) reset(w http.ResponseWriter) {
|
func (r *Response) reset(w http.ResponseWriter) {
|
||||||
r.writer = w
|
r.writer = w
|
||||||
|
r.size = 0
|
||||||
r.status = http.StatusOK
|
r.status = http.StatusOK
|
||||||
r.committed = false
|
r.committed = false
|
||||||
}
|
}
|
||||||
|
@ -37,4 +37,10 @@ func TestResponse(t *testing.T) {
|
|||||||
if r.Size() != int64(len(s)) {
|
if r.Size() != int64(len(s)) {
|
||||||
t.Errorf("size should be %d", len(s))
|
t.Errorf("size should be %d", len(s))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reser
|
||||||
|
r.reset(httptest.NewRecorder())
|
||||||
|
if r.Size() != int64(0) {
|
||||||
|
t.Error("size should be 0")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user