mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-22 01:12:16 +08:00
fix
This commit is contained in:
parent
ff871296f5
commit
be3e5d345b
@ -309,15 +309,15 @@ func TestErrorLogger(t *testing.T) {
|
||||
|
||||
w := performRequest(router, "GET", "/error")
|
||||
assert.Equal(t, http.StatusOK, w.Code)
|
||||
assert.Equal(t, "{\"error\":\"this is an error\"}", w.Body.String())
|
||||
assert.Equal(t, "{\"error\":\"this is an error\"}\n", w.Body.String())
|
||||
|
||||
w = performRequest(router, "GET", "/abort")
|
||||
assert.Equal(t, http.StatusUnauthorized, w.Code)
|
||||
assert.Equal(t, "{\"error\":\"no authorized\"}", w.Body.String())
|
||||
assert.Equal(t, "{\"error\":\"no authorized\"}\n", w.Body.String())
|
||||
|
||||
w = performRequest(router, "GET", "/print")
|
||||
assert.Equal(t, http.StatusInternalServerError, w.Code)
|
||||
assert.Equal(t, "hola!{\"error\":\"this is an error\"}", w.Body.String())
|
||||
assert.Equal(t, "hola!{\"error\":\"this is an error\"}\n", w.Body.String())
|
||||
}
|
||||
|
||||
func TestLoggerWithWriterSkippingPaths(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user