Skip to content

Commit

Permalink
fix: ErrorRoutingIT
Browse files Browse the repository at this point in the history
- the test is intended to access /error429 as a browser would
and expects a 200 response (due to this request mapping:
https://github.com/cloudfoundry/uaa/blob/0a28b5c5aa33c68a5cdb20f23812d5187135b4a8/server/src/main/java/org/cloudfoundry/identity/uaa/home/HomeController.java#L155 and NOT https://github.com/cloudfoundry/uaa/blob/0a28b5c5aa33c68a5cdb20f23812d5187135b4a8/server/src/main/java/org/cloudfoundry/identity/uaa/home/HomeController.java#L144)

- however, in some environments where this test is run, the test
does not access the /error429 like a browser would (e.g. does not
have the request header "Accept: text/html" by default), so explictly
adding this header to the test setup to better emulate a browser
request
  • Loading branch information
peterhaochen47 committed Jul 23, 2024
1 parent de7aa70 commit fd9f193
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void testRequestRejectedExceptionErrorPage() throws IOException {
private String CallErrorPageAndCheckHttpStatusCode(String errorPath, String method, int codeExpected) throws IOException {
HttpURLConnection cn = (HttpURLConnection)new URL(baseUrl + errorPath).openConnection();
cn.setRequestMethod(method);
cn.setRequestProperty("Accept", "text/html");
// connection initiate
cn.connect();
Assert.assertEquals("Check status code from " + errorPath + " is " + codeExpected, codeExpected, cn.getResponseCode());
Expand Down

0 comments on commit fd9f193

Please sign in to comment.