forked from mirror/gin
Improve serveError code coverage (#980)
This commit is contained in:
parent
b985857899
commit
436d8e2af9
|
@ -439,3 +439,15 @@ func TestRouteRawPathNoUnescape(t *testing.T) {
|
||||||
w := performRequest(route, "POST", "/project/Some%2FOther%2FProject/build/333")
|
w := performRequest(route, "POST", "/project/Some%2FOther%2FProject/build/333")
|
||||||
assert.Equal(t, w.Code, 200)
|
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())
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue