assertHttpResponse asserts the forceError against HTTP response.
(t *testing.T, response *http.Response, forceError forceError)
| 945 | |
| 946 | // assertHttpResponse asserts the forceError against HTTP response. |
| 947 | func assertHttpResponse(t *testing.T, response *http.Response, forceError forceError) { |
| 948 | bodyBytes, err := io.ReadAll(response.Body) |
| 949 | require.NoError(t, err, "error reading response body") |
| 950 | assert.Contains(t, string(bodyBytes), forceError.expectedErrorMessage) |
| 951 | assert.Equal(t, forceError.expectedErrorCode, response.StatusCode) |
| 952 | require.NoError(t, response.Body.Close(), "error closing response body") |
| 953 | } |
| 954 | |
| 955 | // refreshProviderConfig updates the issuer URL and sets the discovery endpoint |
| 956 | // in provider configuration. |
no test coverage detected