Interface InterceptedWebExchange<A extends ExchangeContext>
- Type Parameters:
A- the exchange context type
- All Superinterfaces:
BaseExchange<A,,InterceptedRequest, InterceptedResponse> InterceptedExchange<A>
An intercepted Web exchange extending HTTP client InterceptedExchange.
It especially provides response body encoding based on the response content type as well as configurable error status mapper.
- Since:
- 1.12
- Author:
- Jeremy Kuhn
-
Method Summary
Modifier and TypeMethodDescriptionfailOnErrorStatus(Function<WebResponse, Mono<Void>> errorMapper) Specifies the error status mapper to convert error responses (i.e. with a4xxor5xxstatus) to exceptions.request()Returns an intercepted request which proxies the original request and allows to override values before it is sent to the endpoint.response()Returns an intercepted response which allows to provide a complete response when bypassing the sending of the request or transform the actual response body.Methods inherited from interface io.inverno.mod.http.base.BaseExchange
context, getCancelCause, getProtocol, reset, reset
-
Method Details
-
failOnErrorStatus
Specifies the error status mapper to convert error responses (i.e. with a
4xxor5xxstatus) to exceptions.This mapper is used when a Web exchange has been set to fail on error responses (see
WebExchange.failOnErrorStatus(boolean)) and only when the response status code is greater than 400 included. It must map the error response to an errorMonowhen a particular error must be propagated or an emptyMonoif the error should not be propagated.- Parameters:
errorMapper- an error response mapper returning an errorMonoto propagate the error or an emptyMonoto ignore it- Returns:
- the intercepted Web exchange
-
request
InterceptedWebRequest request()Description copied from interface:InterceptedExchangeReturns an intercepted request which proxies the original request and allows to override values before it is sent to the endpoint.
Once the request is sent to the endpoint, the intercepted request becomes a proxy for the sent request and it can no longer be used to modify request data.
- Specified by:
requestin interfaceBaseExchange<A extends ExchangeContext,InterceptedRequest, InterceptedResponse> - Specified by:
requestin interfaceInterceptedExchange<A extends ExchangeContext>- Returns:
- the request part
-
response
InterceptedWebResponse response()Description copied from interface:InterceptedExchangeReturns an intercepted response which allows to provide a complete response when bypassing the sending of the request or transform the actual response body.
Once a response is received from the endpoint the intercepted response becomes a proxy for the received response and it can no longer be used to modify response data.
- Specified by:
responsein interfaceBaseExchange<A extends ExchangeContext,InterceptedRequest, InterceptedResponse> - Specified by:
responsein interfaceInterceptedExchange<A extends ExchangeContext>- Returns:
- the response part
-