-
public interface ClientHttpResponseLow-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 Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ObjectgetBody()Returns low-level object that represents received HTTP body.byte[]getBodyAsBytes()Returns byte array of the received HTTP body.default StringgetBodyAsString()Returns the received HTTP body as UTF8 string.HttpHeadersgetHeaders()Returns theHttpHeadersof the received HTTP response.intgetStatusCode()Returns the received status code.HttpVersiongetVersion()Returns theHttpVersionof the received HTTP response.booleanisBodyEmpty()Returnstrueif the received HTTP response does not contain HTTP body.
-
-
-
Method Detail
-
getStatusCode
int getStatusCode()
Returns the received status code.- Returns:
- the received status code
-
getVersion
HttpVersion getVersion()
Returns theHttpVersionof the received HTTP response.- Returns:
- the
HttpVersionof the received HTTP response
-
getHeaders
HttpHeaders getHeaders()
Returns theHttpHeadersof the received HTTP response.- Returns:
- the
HttpHeadersof the received HTTP response
-
isBodyEmpty
boolean isBodyEmpty()
Returnstrueif the received HTTP response does not contain HTTP body.- Returns:
trueif 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
-
-