Polishing contribution

See gh-37099
This commit is contained in:
rstoyanchev
2026-08-24 17:18:17 +01:00
parent 8d4208f030
commit 495fd6b3a5
2 changed files with 5 additions and 6 deletions
@@ -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);
@@ -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