mirror of
https://github.com/gin-gonic/gin.git
synced 2025-08-06 07:40:39 +08:00
Write header immediately in AbortWithStatus()
Otherwise, caller needs to invoke WriteHeaderNow himself after AbortWithStatus(), which is error-prone. Also modified ErrorLoggerT() such that it always writes log to response body. Otherwise calling AbortWithStatus() will fail to write body because c.Writer.Written() is set true by WriteHeaderNow().
This commit is contained in:
@ -39,5 +39,5 @@ func TestPanicWithAbort(t *testing.T) {
|
||||
// RUN
|
||||
w := performRequest(router, "GET", "/recovery")
|
||||
// TEST
|
||||
assert.Equal(t, w.Code, 500) // NOT SURE
|
||||
assert.Equal(t, w.Code, 400)
|
||||
}
|
||||
|
Reference in New Issue
Block a user