1
0
mirror of https://github.com/labstack/echo.git synced 2025-04-15 11:56:51 +02:00

Merge pull request #201 from syntaqx/master

Adding Response.Committed Getter
This commit is contained in:
Vishal Rana 2015-09-13 09:48:28 -07:00
commit 71ae409ea7
2 changed files with 9 additions and 1 deletions

View File

@ -74,6 +74,10 @@ func (r *Response) Size() int64 {
return r.size return r.size
} }
func (r *Response) Committed() bool {
return r.committed
}
func (r *Response) reset(w http.ResponseWriter) { func (r *Response) reset(w http.ResponseWriter) {
r.writer = w r.writer = w
r.size = 0 r.size = 0

View File

@ -1,10 +1,11 @@
package echo package echo
import ( import (
"github.com/stretchr/testify/assert"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"testing" "testing"
"github.com/stretchr/testify/assert"
) )
func TestResponse(t *testing.T) { func TestResponse(t *testing.T) {
@ -46,6 +47,9 @@ func TestResponse(t *testing.T) {
// Size // Size
assert.EqualValues(t, len(s), r.Size()) assert.EqualValues(t, len(s), r.Size())
// Committed
assert.Equal(t, true, r.Committed())
// Hijack // Hijack
assert.Panics(t, func() { assert.Panics(t, func() {
r.Hijack() r.Hijack()