Interface RawResponse

All Known Implementing Classes:
JavaResponse, MockRawResponse, RawResponseBase

public interface RawResponse
The Raw Response represents the response before any mapping or consumption of the content.
  • Method Details

    • getStatus

      int getStatus()
      Returns the status code for this response.
      Returns:
      the response code
    • getStatusText

      String getStatusText()
      Returns the status text for this response.
      Returns:
      the response text
    • getHeaders

      Headers getHeaders()
      Returns the received response headers.
      Returns:
      the response headers
    • getContent

      InputStream getContent()
      Returns the body content of the response as a InputStream. Like most InputStreams it can only be read once. If you read the response though some other method like getContentAsBytes() or getBodyAsString() it will read this method and consume the InputStream
      Returns:
      the content
    • getContentAsBytes

      byte[] getContentAsBytes()
      Returns the body as bytes. This consumes the entire InputStream. Warning: Calling this on very large responses will place all data in memory and could create OutOfMemory errors
      Returns:
      the content as bytes
    • getContentAsString

      String getContentAsString()
      Returns the body as UTF-8 String. This consumes the entire InputStream. Warning: Calling this on very large responses will place all data in memory and could create OutOfMemory errors Using this method with a binary response will make you sad
      Returns:
      the content as a UTF-8 String
    • getContentAsString

      String getContentAsString(String charset)
      Returns the body as UTF-8 String. This consumes the entire InputStream. Warning: Calling this on very large responses will place all data in memory and could create OutOfMemory errors Using this method with a binary response will make you sad
      Parameters:
      charset - the charset for the String
      Returns:
      the content as a string in the provided charset.
    • getContentReader

      InputStreamReader getContentReader()
      Returns the body content of the response as a InputStreamReader. Like most InputStreams it can only be read once. If you read the response though some other method like getContentAsBytes() or getBodyAsString() it will read this method and consume the InputStream
      Returns:
      the content
    • hasContent

      boolean hasContent()
      Indicates that the response has content
      Returns:
      boolean indicating that the response has content.
    • getContentType

      String getContentType()
      Returns the mime type of the response content as indicated by the Content-Type header or a empty string if none is supplied (e.g. application/json)
      Returns:
      the Content-Type
    • getEncoding

      String getEncoding()
      Returns the encoding of the response as indicated by the Content-Encoding header or returns a empty string if none provided.
      Returns:
      the encoding
    • getConfig

      Config getConfig()
      Returns the current config for this request/response
      Returns:
      the config
    • getRequestSummary

      HttpRequestSummary getRequestSummary()
      returns a lightweight read only summary of the request.
      Returns:
      the request summary
    • toSummary

      HttpResponseSummary toSummary()
      returns a lightweight read only summary of the response.
      Returns:
      the response summary