Handle URI as candidate for a merge from a parent builder

Closes gh-33057
This commit is contained in:
Stéphane Nicoll
2024-06-17 17:01:35 +02:00
parent b8790077b9
commit 1582f5f7d1
2 changed files with 76 additions and 0 deletions

View File

@@ -592,6 +592,9 @@ public abstract class AbstractMockHttpServletRequestBuilder<B extends AbstractMo
if (!(parent instanceof AbstractMockHttpServletRequestBuilder<?> parentBuilder)) {
throw new IllegalArgumentException("Cannot merge with [" + parent.getClass().getName() + "]");
}
if (this.uri == null) {
this.uri = parentBuilder.uri;
}
if (!StringUtils.hasText(this.contextPath)) {
this.contextPath = parentBuilder.contextPath;
}