- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
ExchangeFunction exchangeFunction = ExchangeFunctions.create(new ReactorClientHttpConnector()); URI url = URI.create("https://example.com/resource"); ClientRequest request = ClientRequest.create(HttpMethod.GET, url).build(); Mono<String> bodyMono = exchangeFunction .exchange(request) .flatMap(response -> response.bodyToMono(String.class));
- Arjen Poutsma
exchangeExchange the given request for a
Note: When calling this method from an
ExchangeFilterFunctionthat handles the response in some way, extra care must be taken to always consume its content or otherwise propagate it downstream for further handling, for example by the
WebClient. Please, see the reference documentation for more details on this.
request- the request to exchange
- the delayed response
filterFilter the exchange function with the given
ExchangeFilterFunction, resulting in a filtered
filter- the filter to apply to this exchange
- the filtered exchange
- See Also: