(t *testing.T, header http.Header, forceJSONErrors bool)
| 1723 | } |
| 1724 | |
| 1725 | func testAjaxUnauthorizedRequest(t *testing.T, header http.Header, forceJSONErrors bool) { |
| 1726 | test, err := newAjaxRequestTest(forceJSONErrors) |
| 1727 | if err != nil { |
| 1728 | t.Fatal(err) |
| 1729 | } |
| 1730 | endpoint := "/test" |
| 1731 | |
| 1732 | code, rh, body, err := test.getEndpoint(endpoint, header) |
| 1733 | assert.NoError(t, err) |
| 1734 | assert.Equal(t, http.StatusUnauthorized, code) |
| 1735 | mime := rh.Get("Content-Type") |
| 1736 | assert.Equal(t, applicationJSON, mime) |
| 1737 | assert.Equal(t, []byte("{}"), body) |
| 1738 | } |
| 1739 | func TestAjaxUnauthorizedRequest1(t *testing.T) { |
| 1740 | header := make(http.Header) |
| 1741 | header.Add("accept", applicationJSON) |
no test coverage detected