public static interface WebTestClient.Builder
WebClient used to test with
internally delegating to a WebClient.Builder.| Modifier and Type | Method and Description |
|---|---|
WebTestClient.Builder |
apply(WebTestClientConfigurer configurer)
Shortcut for pre-packaged customizations to WebTestClient builder.
|
WebTestClient.Builder |
baseUrl(java.lang.String baseUrl)
Configure a base URI as described in
WebClient.create(String). |
WebTestClient |
build()
Build the
WebTestClient instance. |
WebTestClient.Builder |
defaultCookie(java.lang.String cookieName,
java.lang.String... cookieValues)
Add the given header to all requests that haven't added it.
|
WebTestClient.Builder |
defaultCookies(java.util.function.Consumer<MultiValueMap<java.lang.String,java.lang.String>> cookiesConsumer)
Manipulate the default cookies with the given consumer.
|
WebTestClient.Builder |
defaultHeader(java.lang.String headerName,
java.lang.String... headerValues)
Add the given header to all requests that haven't added it.
|
WebTestClient.Builder |
defaultHeaders(java.util.function.Consumer<HttpHeaders> headersConsumer)
Manipulate the default headers with the given consumer.
|
WebTestClient.Builder |
exchangeStrategies(ExchangeStrategies strategies)
Configure the
ExchangeStrategies to use. |
WebTestClient.Builder |
filter(ExchangeFilterFunction filter)
Add the given filter to the filter chain.
|
WebTestClient.Builder |
filters(java.util.function.Consumer<java.util.List<ExchangeFilterFunction>> filtersConsumer)
Manipulate the filters with the given consumer.
|
WebTestClient.Builder |
responseTimeout(java.time.Duration timeout)
Max amount of time to wait for responses.
|
WebTestClient.Builder |
uriBuilderFactory(UriBuilderFactory uriBuilderFactory)
Provide a pre-configured
UriBuilderFactory instance as an
alternative to and effectively overriding baseUrl(String). |
WebTestClient.Builder baseUrl(java.lang.String baseUrl)
WebClient.create(String).WebTestClient.Builder uriBuilderFactory(UriBuilderFactory uriBuilderFactory)
UriBuilderFactory instance as an
alternative to and effectively overriding baseUrl(String).WebTestClient.Builder defaultHeader(java.lang.String headerName, java.lang.String... headerValues)
headerName - the header nameheaderValues - the header valuesWebTestClient.Builder defaultHeaders(java.util.function.Consumer<HttpHeaders> headersConsumer)
HttpHeaders methods.headersConsumer - a function that consumes the HttpHeadersWebTestClient.Builder defaultCookie(java.lang.String cookieName, java.lang.String... cookieValues)
cookieName - the cookie namecookieValues - the cookie valuesWebTestClient.Builder defaultCookies(java.util.function.Consumer<MultiValueMap<java.lang.String,java.lang.String>> cookiesConsumer)
MultiValueMap methods.cookiesConsumer - a function that consumes the cookies mapWebTestClient.Builder filter(ExchangeFilterFunction filter)
filter - the filter to be added to the chainWebTestClient.Builder filters(java.util.function.Consumer<java.util.List<ExchangeFilterFunction>> filtersConsumer)
filtersConsumer - a function that consumes the filter listWebTestClient.Builder exchangeStrategies(ExchangeStrategies strategies)
ExchangeStrategies to use.
By default ExchangeStrategies.withDefaults() is used.
strategies - the strategies to useWebTestClient.Builder responseTimeout(java.time.Duration timeout)
By default 5 seconds.
timeout - the response timeout valueWebTestClient.Builder apply(WebTestClientConfigurer configurer)
configurer - the configurer to applyWebTestClient build()
WebTestClient instance.