private static <T> ClientRequest toClientRequest(HttpRequestValues requestValues, HttpMethod httpMethod,
                                                     URI uri) {
        final ClientRequest.Builder builder =
                ClientRequest.create(httpMethod, uri)
                             .headers(headers -> headers.addAll(requestValues.getHeaders()))
                             .cookies(cookies -> cookies.addAll(requestValues.getCookies()));

        final Object bodyValue = requestValues.getBodyValue();
        if (bodyValue != null) {
            builder.body(BodyInserters.fromValue(bodyValue));
        } else if (requestValues instanceof ReactiveHttpRequestValues) {
            final ReactiveHttpRequestValues reactiveRequestValues = (ReactiveHttpRequestValues) requestValues;
            @SuppressWarnings("unchecked")
            final Publisher<T> body = (Publisher<T>) reactiveRequestValues.getBodyPublisher();
            if (body != null) {
                @SuppressWarnings("unchecked")
                final ParameterizedTypeReference<T> elementType =
                        (ParameterizedTypeReference<T>) reactiveRequestValues.getBodyPublisherElementType();
                requireNonNull(elementType, "Publisher body element type is required");
                builder.body(body, elementType);
            }
        }

        return builder.build();
    }
Sends the specified {@link HttpRequestValues} to the {@link WebClient} and returns the response.

<p><h4>Implementation note</h4>
In order to encode {@link HttpRequestValues#getBodyValue()} to {@link HttpData}, we need to convert
the {@link HttpRequestValues} to {@link ClientRequest} first. The serialization process is delegated to
the {@link ClientRequest}. After that, the request is written to {@link ArmeriaClientHttpRequest} to send
the request via the {@link WebClient}.

<p>The response handling has to be done in the reverse order. Armeria {@link HttpResponse} is converted
into {@link ArmeriaClientHttpResponse} first and then converted into {@link ClientResponse}.
spring/spring6/src/main/java/com/linecorp/armeria/spring/client/ArmeriaHttpExchangeAdapter.java