mirror of
https://github.com/labstack/echo.git
synced 2025-01-01 22:09:21 +02:00
parent
5d3ea7014b
commit
be5efe5927
@ -12,7 +12,7 @@ env:
|
|||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- export PATH=$PATH:$GOPATH/bin
|
- export PATH=$PATH:$GOPATH/bin
|
||||||
- go get golang.org/x/tools/cmd/vet
|
# - go get golang.org/x/tools/cmd/vet
|
||||||
- go get golang.org/x/tools/cmd/cover
|
- go get golang.org/x/tools/cmd/cover
|
||||||
- go get github.com/modocache/gover
|
- go get github.com/modocache/gover
|
||||||
- go get github.com/mattn/goveralls
|
- go get github.com/mattn/goveralls
|
||||||
|
@ -64,3 +64,27 @@ func TestResponse(t *testing.T) {
|
|||||||
// reset
|
// reset
|
||||||
r.reset(httptest.NewRecorder(), New())
|
r.reset(httptest.NewRecorder(), New())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestResponseWriteCommit(t *testing.T) {
|
||||||
|
e := New()
|
||||||
|
w := httptest.NewRecorder()
|
||||||
|
r := NewResponse(w, e)
|
||||||
|
|
||||||
|
// Write body, it writes header if not committed yet
|
||||||
|
s := "echo"
|
||||||
|
r.Write([]byte(s))
|
||||||
|
|
||||||
|
assert.Equal(t, w.Code, 200)
|
||||||
|
assert.Equal(t, w.Body.String(), s)
|
||||||
|
|
||||||
|
assert.Equal(t, r.Status(), 200)
|
||||||
|
assert.Equal(t, r.Size(), int64(4))
|
||||||
|
assert.True(t, r.Committed())
|
||||||
|
|
||||||
|
// This is ignored with warning
|
||||||
|
r.WriteHeader(400)
|
||||||
|
|
||||||
|
assert.Equal(t, r.Status(), 200)
|
||||||
|
assert.Equal(t, r.Size(), int64(4))
|
||||||
|
assert.True(t, r.Committed())
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user