Browse Source

Fix Jetty 10+ test failure related to empty path handling

See gh-27424
pull/27435/head
Rossen Stoyanchev 4 years ago
parent
commit
853ab5d67b
  1. 10
      spring-web/src/test/java/org/springframework/http/server/reactive/ErrorHandlerIntegrationTests.java

10
spring-web/src/test/java/org/springframework/http/server/reactive/ErrorHandlerIntegrationTests.java

@ -27,6 +27,7 @@ import org.springframework.web.client.ResponseErrorHandler; @@ -27,6 +27,7 @@ import org.springframework.web.client.ResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.testfixture.http.server.reactive.bootstrap.AbstractHttpHandlerIntegrationTests;
import org.springframework.web.testfixture.http.server.reactive.bootstrap.HttpServer;
import org.springframework.web.testfixture.http.server.reactive.bootstrap.JettyHttpServer;
import static org.assertj.core.api.Assertions.assertThat;
@ -80,7 +81,14 @@ class ErrorHandlerIntegrationTests extends AbstractHttpHandlerIntegrationTests { @@ -80,7 +81,14 @@ class ErrorHandlerIntegrationTests extends AbstractHttpHandlerIntegrationTests {
URI url = new URI("http://localhost:" + port + "//");
ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
// Jetty 10+ rejects empty path segments, see https://github.com/eclipse/jetty.project/issues/6302,
// but an application can apply CompactPathRule via RewriteHandler:
// https://www.eclipse.org/jetty/documentation/jetty-11/programming_guide.php
HttpStatus expectedStatus =
(httpServer instanceof JettyHttpServer ? HttpStatus.BAD_REQUEST : HttpStatus.OK);
assertThat(response.getStatusCode()).isEqualTo(expectedStatus);
}

Loading…
Cancel
Save