TestContextAbortWithStatus tests that the response can be written from `bytestring` with specified MIME type
(t *testing.T)
| 1815 | // TestContextAbortWithStatus tests that the response can be written from `bytestring` |
| 1816 | // with specified MIME type |
| 1817 | func TestContextAbortWithStatus(t *testing.T) { |
| 1818 | w := httptest.NewRecorder() |
| 1819 | c, _ := CreateTestContext(w) |
| 1820 | |
| 1821 | c.index = 4 |
| 1822 | c.AbortWithStatus(http.StatusUnauthorized) |
| 1823 | |
| 1824 | assert.Equal(t, abortIndex, c.index) |
| 1825 | assert.Equal(t, http.StatusUnauthorized, c.Writer.Status()) |
| 1826 | assert.Equal(t, http.StatusUnauthorized, w.Code) |
| 1827 | assert.True(t, c.IsAborted()) |
| 1828 | } |
| 1829 | |
| 1830 | type testJSONAbortMsg struct { |
| 1831 | Foo string `json:"foo"` |
nothing calls this directly
no test coverage detected