Fix missing contextPath when mutating ServerHttpRequest

This commit ensures that when mutating `ServerHttpRequest` instances,
the original contextPath information is copied to the request being
built.

Note that mutation on the `contextPath(String)` or `path(String)` should
be reflected to the other. (See their Javadoc for more information).

Fixes gh-25279
This commit is contained in:
Brian Clozel
2020-06-22 19:13:10 +02:00
parent 80d1aaec0c
commit c4326cb0f5
2 changed files with 31 additions and 1 deletions

View File

@@ -71,6 +71,7 @@ class DefaultServerHttpRequestBuilder implements ServerHttpRequest.Builder {
this.uri = original.getURI();
this.httpMethodValue = original.getMethodValue();
this.contextPath = original.getPath().contextPath().value();
this.body = original.getBody();
this.httpHeaders = HttpHeaders.writableHttpHeaders(original.getHeaders());