From 3a28266d0bf08ace62f9f6db2a5f829eaec12d02 Mon Sep 17 00:00:00 2001 From: d036670 Date: Thu, 8 Dec 2022 15:44:10 +0100 Subject: [PATCH] No trace method dispatch --- uaa/src/main/webapp/WEB-INF/web.xml | 2 +- .../integration/feature/ErrorRoutingIT.java | 52 +++++++++++++++---- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/uaa/src/main/webapp/WEB-INF/web.xml b/uaa/src/main/webapp/WEB-INF/web.xml index 8b0ff4261dd..8f0724dc22b 100755 --- a/uaa/src/main/webapp/WEB-INF/web.xml +++ b/uaa/src/main/webapp/WEB-INF/web.xml @@ -103,7 +103,7 @@ dispatchTraceRequest - true + false 1 diff --git a/uaa/src/test/java/org/cloudfoundry/identity/uaa/integration/feature/ErrorRoutingIT.java b/uaa/src/test/java/org/cloudfoundry/identity/uaa/integration/feature/ErrorRoutingIT.java index 9ddfc4542aa..9c0776f631e 100644 --- a/uaa/src/test/java/org/cloudfoundry/identity/uaa/integration/feature/ErrorRoutingIT.java +++ b/uaa/src/test/java/org/cloudfoundry/identity/uaa/integration/feature/ErrorRoutingIT.java @@ -1,5 +1,6 @@ package org.cloudfoundry.identity.uaa.integration.feature; +import org.apache.commons.io.IOUtils; import org.junit.*; import org.junit.runner.RunWith; import org.openqa.selenium.By; @@ -9,7 +10,9 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import java.io.BufferedReader; import java.io.IOException; +import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; @@ -37,14 +40,20 @@ public void testMethodNotAllowedRoutedToErrorPage() { @Test public void testStatusCodeToErrorPage() throws IOException { - CallErrorPageAndCheckHttpStatusCode("/error", 200); - CallErrorPageAndCheckHttpStatusCode("/error404", 200); - CallErrorPageAndCheckHttpStatusCode("/error429", 200); - CallErrorPageAndCheckHttpStatusCode("/error500", 200); - CallErrorPageAndCheckHttpStatusCode("/errorAny", 200); - CallErrorPageAndCheckHttpStatusCode("/rejected", 200); - CallErrorPageAndCheckHttpStatusCode("/saml_error", 200); + CallErrorPageAndCheckHttpStatusCode("/error", "GET", 200); + CallErrorPageAndCheckHttpStatusCode("/error404", "GET", 200); + CallErrorPageAndCheckHttpStatusCode("/error429", "GET", 200); + CallErrorPageAndCheckHttpStatusCode("/error500", "GET", 200); + CallErrorPageAndCheckHttpStatusCode("/errorAny", "GET", 200); + CallErrorPageAndCheckHttpStatusCode("/rejected", "GET", 200); + CallErrorPageAndCheckHttpStatusCode("/saml_error", "GET", 200); + CallErrorPageAndCheckHttpStatusCode("/error", "GET", 200); + } + @Test + public void testResponseToErrorPage() throws IOException { + String body = CallErrorPageAndCheckHttpStatusCode("/info", "TRACE", 405); + Assert.assertTrue("Expected no response HTML body, but received: " + body, body.indexOf("