Interface InterceptableResponse
- All Superinterfaces:
BaseResponse
An interceptable response is exposed in the InterceptableExchange
to allow an exchange interceptor to provide a response when canceling the request sent by returning an empty exhange Mono.
Once a response is received from the endpoint, it becomes a proxy for the received response and it is no longer possible to modify it resulting in IllegalStateException
on such operations.
It might still be possible to intercept and transform the response payload publisher if it hasn't been subscribed yet.
- Since:
- 1.6
- Author:
- Jeremy Kuhn
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbody()
Returns the response body.headers
(Consumer<OutboundResponseHeaders> headersConfigurer) Configures the HTTP headers of the response to return in case the request sent is cancelled.boolean
Determines whether the response has been received from the endpoint.trailers
(Consumer<OutboundHeaders<?>> trailersConfigurer) Configures the HTTP trailers of the response to return in case the request sent is cancelled.Methods inherited from interface io.inverno.mod.http.base.BaseResponse
headers, trailers
-
Method Details
-
headers
InterceptableResponse headers(Consumer<OutboundResponseHeaders> headersConfigurer) throws IllegalStateException Configures the HTTP headers of the response to return in case the request sent is cancelled.
- Parameters:
headersConfigurer
- an outbound response headers configurer- Returns:
- the request
- Throws:
IllegalStateException
- if the response has already been received from the endpoint
-
trailers
InterceptableResponse trailers(Consumer<OutboundHeaders<?>> trailersConfigurer) throws IllegalStateException Configures the HTTP trailers of the response to return in case the request sent is cancelled.
- Parameters:
trailersConfigurer
- an outbound headers configurer- Returns:
- the request
- Throws:
IllegalStateException
- if the response has already been received from the endpoint
-
body
InterceptableResponseBody body()Returns the response body.
- Returns:
- the response body
-
isReceived
boolean isReceived()Determines whether the response has been received from the endpoint.
- Returns:
- true if the response has been received, false otherwise
-