Merge 99f2da59c13a652a9fe6c398feba591271184e29 into 7a9a290b36bb803a18874aa5c5b108be2d7eb34d

This commit is contained in:
白维 2018-01-24 01:09:22 +00:00 committed by GitHub
commit a147bca4ee
4 changed files with 6 additions and 5 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ vendor/*
!vendor/vendor.json
coverage.out
count.out

View File

@ -125,7 +125,7 @@ func (c *Context) Abort() {
// For example, a failed attempt to authenticate a request could use: context.AbortWithStatus(401).
func (c *Context) AbortWithStatus(code int) {
c.Status(code)
c.Writer.WriteHeaderNow()
//c.Writer.WriteHeaderNow()
c.Abort()
}

View File

@ -992,7 +992,7 @@ func TestContextNegotiationNotSupport(t *testing.T) {
Offered: []string{MIMEPOSTForm},
})
assert.Equal(t, 406, w.Code)
assert.Equal(t, 200, w.Code)
assert.Equal(t, c.index, abortIndex)
assert.True(t, c.IsAborted())
}
@ -1054,7 +1054,7 @@ func TestContextAbortWithStatus(t *testing.T) {
assert.Equal(t, abortIndex, c.index)
assert.Equal(t, 401, c.Writer.Status())
assert.Equal(t, 401, w.Code)
assert.Equal(t, 200, w.Code)
assert.True(t, c.IsAborted())
}
@ -1141,7 +1141,7 @@ func TestContextAbortWithError(t *testing.T) {
c.AbortWithError(401, errors.New("bad input")).SetMeta("some input")
assert.Equal(t, 401, w.Code)
assert.Equal(t, 200, w.Code)
assert.Equal(t, abortIndex, c.index)
assert.True(t, c.IsAborted())
}

View File

@ -39,5 +39,5 @@ func TestPanicWithAbort(t *testing.T) {
// RUN
w := performRequest(router, "GET", "/recovery")
// TEST
assert.Equal(t, 400, w.Code)
assert.Equal(t, 500, w.Code)
}