Improve serveError code coverage (#980)

This commit is contained in:
Eason Lin 2017-07-06 09:30:09 +08:00 committed by Bo-Yi Wu
parent b985857899
commit 436d8e2af9
1 changed files with 12 additions and 0 deletions

View File

@ -439,3 +439,15 @@ func TestRouteRawPathNoUnescape(t *testing.T) {
w := performRequest(route, "POST", "/project/Some%2FOther%2FProject/build/333")
assert.Equal(t, w.Code, 200)
}
func TestRouteServeErrorWithWriteHeader(t *testing.T) {
route := New()
route.Use(func(c *Context) {
c.Status(421)
c.Next()
})
w := performRequest(route, "GET", "/NotFound")
assert.Equal(t, 421, w.Code)
assert.Equal(t, 0, w.Body.Len())
}