mirror of
https://github.com/gin-gonic/gin.git
synced 2025-08-06 15:50:30 +08:00
fix testing.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
@ -107,16 +107,16 @@ func TestErrorLogger(t *testing.T) {
|
||||
})
|
||||
|
||||
w := performRequest(router, "GET", "/error")
|
||||
assert.Equal(t, w.Code, 200)
|
||||
assert.Equal(t, w.Body.String(), "{\"error\":\"this is an error\"}\n")
|
||||
assert.Equal(t, 200, w.Code)
|
||||
assert.Equal(t, "{\"error\":\"this is an error\"}", w.Body.String())
|
||||
|
||||
w = performRequest(router, "GET", "/abort")
|
||||
assert.Equal(t, w.Code, 401)
|
||||
assert.Equal(t, w.Body.String(), "{\"error\":\"no authorized\"}\n")
|
||||
assert.Equal(t, 401, w.Code)
|
||||
assert.Equal(t, "{\"error\":\"no authorized\"}", w.Body.String())
|
||||
|
||||
w = performRequest(router, "GET", "/print")
|
||||
assert.Equal(t, w.Code, 500)
|
||||
assert.Equal(t, w.Body.String(), "hola!{\"error\":\"this is an error\"}\n")
|
||||
assert.Equal(t, 500, w.Code)
|
||||
assert.Equal(t, "hola!{\"error\":\"this is an error\"}", w.Body.String())
|
||||
}
|
||||
|
||||
func TestSkippingPaths(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user