MCPcopy
hub / github.com/oauth2-proxy/oauth2-proxy / testAjaxUnauthorizedRequest

Function testAjaxUnauthorizedRequest

oauthproxy_test.go:1725–1738  ·  view source on GitHub ↗
(t *testing.T, header http.Header, forceJSONErrors bool)

Source from the content-addressed store, hash-verified

1723}
1724
1725func 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}
1739func TestAjaxUnauthorizedRequest1(t *testing.T) {
1740 header := make(http.Header)
1741 header.Add("accept", applicationJSON)

Calls 3

newAjaxRequestTestFunction · 0.85
getEndpointMethod · 0.80
GetMethod · 0.65

Tested by

no test coverage detected