mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 08:24:13 +00:00
Polishing contribution
See gh-37099
This commit is contained in:
+1
-2
@@ -146,8 +146,7 @@ public interface ServerHttpRequest extends HttpRequest, ReactiveHttpInputMessage
|
||||
* contextPath} and it must match the start of the path of the URI of
|
||||
* the request. That means changing the contextPath, implies also
|
||||
* changing the path via {@link #path(String)}.
|
||||
* <p>The given value may be {@code null} or empty to indicate there
|
||||
* is no context path.
|
||||
* <p>Use {@code null} to clear the context path.
|
||||
*/
|
||||
Builder contextPath(@Nullable String contextPath);
|
||||
|
||||
|
||||
+4
-4
@@ -194,14 +194,14 @@ class ServerHttpRequestTests {
|
||||
assertThat(mutated.getURI().getRawPath()).isEqualTo("/other/path");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // gh-37099
|
||||
void mutateContextPathToNull() throws Exception {
|
||||
ServerHttpRequest request = createRequest("/context/path", "/context");
|
||||
|
||||
ServerHttpRequest mutated = request.mutate().contextPath(null).build();
|
||||
ServerHttpRequest mutated = request.mutate().contextPath(null).path("/path").build();
|
||||
assertThat(mutated.getPath().contextPath().value()).isEmpty();
|
||||
assertThat(mutated.getPath().pathWithinApplication().value()).isEqualTo("/context/path");
|
||||
assertThat(mutated.getURI().getRawPath()).isEqualTo("/context/path");
|
||||
assertThat(mutated.getPath().pathWithinApplication().value()).isEqualTo("/path");
|
||||
assertThat(mutated.getURI().getRawPath()).isEqualTo("/path");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user