@ -115,6 +120,7 @@ For more details on working with and encoding URIs, see xref:web/webmvc/mvc-uri-
@@ -115,6 +120,7 @@ For more details on working with and encoding URIs, see xref:web/webmvc/mvc-uri-
If necessary, the HTTP request can be manipulated by adding request headers with `header(String, String)`, `headers(Consumer<HttpHeaders>`, or with the convenience methods `accept(MediaType...)`, `acceptCharset(Charset...)` and so on.
For HTTP requests that can contain a body (`POST`, `PUT`, and `PATCH`), additional methods are available: `contentType(MediaType)`, and `contentLength(long)`.
You can set an API version for the request if the client is configured with `ApiVersionInserter`.
The request body itself can be set by `body(Object)`, which internally uses <<rest-message-conversion>>.
Alternatively, the request body can be set using a `ParameterizedTypeReference`, allowing you to use generics.
The simplest way to create a `WebClient` is through one of the static factory methods:
The simplest way to create `WebClient` is through one of the static factory methods:
* `WebClient.create()`
* `WebClient.create(String baseUrl)`
@ -12,10 +12,12 @@ You can also use `WebClient.builder()` with further options:
@@ -12,10 +12,12 @@ You can also use `WebClient.builder()` with further options:
* `defaultUriVariables`: default values to use when expanding URI templates.
* `defaultHeader`: Headers for every request.
* `defaultCookie`: Cookies for every request.
* `defaultApiVersion`: API version for every request.
* `defaultRequest`: `Consumer` to customize every request.