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 a4xx
or5xx
status) 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
4xx
or5xx
status) 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 errorMono
when a particular error must be propagated or an emptyMono
if the error should not be propagated.- Parameters:
errorMapper
- an error response mapper returning an errorMono
to propagate the error or an emptyMono
to ignore it- Returns:
- the intercepted Web exchange
-
request
InterceptedWebRequest request()Description copied from interface:InterceptedExchange
Returns 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:
request
in interfaceBaseExchange<A extends ExchangeContext,
InterceptedRequest, InterceptedResponse> - Specified by:
request
in interfaceInterceptedExchange<A extends ExchangeContext>
- Returns:
- the request part
-
response
InterceptedWebResponse response()Description copied from interface:InterceptedExchange
Returns 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:
response
in interfaceBaseExchange<A extends ExchangeContext,
InterceptedRequest, InterceptedResponse> - Specified by:
response
in interfaceInterceptedExchange<A extends ExchangeContext>
- Returns:
- the response part
-