Class ClientResponse


  • public class ClientResponse
    extends Object
    An HTTP response encapsulating status, headers and accessors to the response body for consumption.

    Make sure you call bodyToMono(Class), skipBody() or similar and actually consume the response body. It is possible to use bodyToMono(Void.class) if the response is empty.

    • Method Detail

      • getBody

        public Mono<ByteBuf> getBody()
        Return the body of this response as a Mono of ByteBuf. If this Mono is cancelled, then it will not be possible to consume the body again.
        Returns:
        the response body contents
      • bodyToMono

        public <T> Mono<T> bodyToMono​(Class<T> responseType)
        Read the response body and extract it to a single object according to the responseType given. If the response has an HTTP error (status codes 4xx and 5xx) the produced object will be a ClientException.
        Type Parameters:
        T - the response type
        Parameters:
        responseType - the target type this response body should be converted into
        Returns:
        a Mono containing the response body extracted into the given T type. If a network or read error had occurred, it will be emitted through the Mono.
      • skipBody

        public Mono<Void> skipBody()
        Consume and release the response body then return and empty Mono.
        Returns:
        an empty Mono indicating response body consumption and release