Skip to content

Commit 3ac6014

Browse files
committed
Improve documentation for uri(URI) method in WebTestClient
Prior to this commit, it was not clear that a configured base URI would not be applied when invoking uri(URI). This commit adds a note to the Javadoc to clarify that behavior. Closes gh-28058
1 parent e3ceb9b commit 3ac6014

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,22 +526,27 @@ interface Builder {
526526
interface UriSpec<S extends RequestHeadersSpec<?>> {
527527

528528
/**
529-
* Specify the URI using an absolute, fully constructed {@link URI}.
529+
* Specify the URI using an absolute, fully constructed {@link java.net.URI}.
530+
* <p>If a {@link UriBuilderFactory} was configured for the client with
531+
* a base URI, that base URI will <strong>not</strong> be applied to the
532+
* supplied {@code java.net.URI}. If you wish to have a base URI applied to a
533+
* {@code java.net.URI} you must invoke either {@link #uri(String, Object...)}
534+
* or {@link #uri(String, Map)} &mdash; for example, {@code uri(myUri.toString())}.
530535
* @return spec to add headers or perform the exchange
531536
*/
532537
S uri(URI uri);
533538

534539
/**
535540
* Specify the URI for the request using a URI template and URI variables.
536-
* If a {@link UriBuilderFactory} was configured for the client (e.g.
541+
* <p>If a {@link UriBuilderFactory} was configured for the client (e.g.
537542
* with a base URI) it will be used to expand the URI template.
538543
* @return spec to add headers or perform the exchange
539544
*/
540545
S uri(String uri, Object... uriVariables);
541546

542547
/**
543548
* Specify the URI for the request using a URI template and URI variables.
544-
* If a {@link UriBuilderFactory} was configured for the client (e.g.
549+
* <p>If a {@link UriBuilderFactory} was configured for the client (e.g.
545550
* with a base URI) it will be used to expand the URI template.
546551
* @return spec to add headers or perform the exchange
547552
*/

0 commit comments

Comments
 (0)