Expose RequestPath in ServerHttpRequest
The new structured getPath() method replaces the existing getContextPath() + getPathWithinApplication(). Issue: SPR-15648
This commit is contained in:
@@ -105,7 +105,7 @@ public class ContextPathCompositeHandlerTests {
|
||||
new ContextPathCompositeHandler(map).handle(request, new MockServerHttpResponse());
|
||||
|
||||
assertTrue(handler.wasInvoked());
|
||||
assertEquals("/yet/another/path", handler.getRequest().getContextPath());
|
||||
assertEquals("/yet/another/path", handler.getRequest().getPath().contextPath().value());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -133,7 +133,7 @@ public class ContextPathCompositeHandlerTests {
|
||||
|
||||
private void assertInvoked(TestHttpHandler handler, String contextPath) {
|
||||
assertTrue(handler.wasInvoked());
|
||||
assertEquals(contextPath, handler.getRequest().getContextPath());
|
||||
assertEquals(contextPath, handler.getRequest().getPath().contextPath().value());
|
||||
}
|
||||
|
||||
private void assertNotInvoked(TestHttpHandler... handlers) {
|
||||
|
||||
@@ -56,7 +56,7 @@ public class RxNettyServerHttpRequest extends AbstractServerHttpRequest {
|
||||
NettyDataBufferFactory dataBufferFactory, InetSocketAddress remoteAddress)
|
||||
throws URISyntaxException {
|
||||
|
||||
super(initUri(request, remoteAddress), initHeaders(request));
|
||||
super(initUri(request, remoteAddress), "", initHeaders(request));
|
||||
this.request = request;
|
||||
|
||||
Assert.notNull(dataBufferFactory, "NettyDataBufferFactory must not be null");
|
||||
|
||||
@@ -56,8 +56,6 @@ public class MockServerHttpRequest extends AbstractServerHttpRequest {
|
||||
|
||||
private final HttpMethod httpMethod;
|
||||
|
||||
private final String contextPath;
|
||||
|
||||
private final MultiValueMap<String, HttpCookie> cookies;
|
||||
|
||||
private final InetSocketAddress remoteAddress;
|
||||
@@ -70,9 +68,8 @@ public class MockServerHttpRequest extends AbstractServerHttpRequest {
|
||||
InetSocketAddress remoteAddress,
|
||||
Publisher<? extends DataBuffer> body) {
|
||||
|
||||
super(uri, headers);
|
||||
super(uri, contextPath, headers);
|
||||
this.httpMethod = httpMethod;
|
||||
this.contextPath = (contextPath != null ? contextPath : "");
|
||||
this.cookies = cookies;
|
||||
this.remoteAddress = remoteAddress;
|
||||
this.body = Flux.from(body);
|
||||
@@ -89,11 +86,6 @@ public class MockServerHttpRequest extends AbstractServerHttpRequest {
|
||||
return this.httpMethod.name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContextPath() {
|
||||
return this.contextPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress getRemoteAddress() {
|
||||
return this.remoteAddress;
|
||||
|
||||
Reference in New Issue
Block a user