Fix Jetty 10+ test failure related to empty path handling
See gh-27424
This commit is contained in:
@@ -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 {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user