Interface ClientHttpResponse


  • public interface ClientHttpResponse
    Low-level interface that contains the received HTTP response data from HTTP server.

    This class can be used for REST-based microservice testing.

    Since:
    0.1
    Author:
    nedis
    See Also:
    HttpClient, HttpClientFactory, HttpClientContentConverter
    • Method Detail

      • getStatusCode

        int getStatusCode()
        Returns the received status code.
        Returns:
        the received status code
      • isBodyEmpty

        boolean isBodyEmpty()
        Returns true if the received HTTP response does not contain HTTP body.
        Returns:
        true if the received HTTP response does not contain HTTP body
      • getBody

        Object getBody()
        Returns low-level object that represents received HTTP body.

        Type of returned value is depended on message exchange format used for HTTP client.

        Returns:
        low-level object that represents received HTTP body or empty object (empty map or empty list or empty array, etc) if body is not present
      • getBodyAsBytes

        byte[] getBodyAsBytes()
        Returns byte array of the received HTTP body.

        If body is not present, this method returns empty array.

        Returns:
        byte array of the received HTTP body or empty array if body is not present
      • getBodyAsString

        default String getBodyAsString()
        Returns the received HTTP body as UTF8 string.
        Returns:
        the received HTTP body as UTF8 string or empty string if body is not present