fix(context): panic on NegotiateFormat - index out of range (#3397)
This commit is contained in:
committed by
GitHub
parent
3010cbd7f4
commit
7cb151bb4c
@ -1311,6 +1311,14 @@ func TestContextNegotiationFormatCustom(t *testing.T) {
|
||||
assert.Equal(t, MIMEJSON, c.NegotiateFormat(MIMEJSON))
|
||||
}
|
||||
|
||||
func TestContextNegotiationFormat2(t *testing.T) {
|
||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||
c.Request, _ = http.NewRequest("POST", "/", nil)
|
||||
c.Request.Header.Add("Accept", "image/tiff-fx")
|
||||
|
||||
assert.Equal(t, "", c.NegotiateFormat("image/tiff"))
|
||||
}
|
||||
|
||||
func TestContextIsAborted(t *testing.T) {
|
||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||
assert.False(t, c.IsAborted())
|
||||
|
Reference in New Issue
Block a user