public class MockClientHttpResponse extends MockHttpInputMessage implements ClientHttpResponse
ClientHttpResponse
.Constructor and Description |
---|
MockClientHttpResponse(byte[] body,
HttpStatus statusCode)
Constructor with response body as a byte array.
|
MockClientHttpResponse(InputStream body,
HttpStatus statusCode)
Constructor with response body as InputStream.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close this response, freeing any resources created.
|
int |
getRawStatusCode()
Return the HTTP status code (potentially non-standard and not
resolvable through the
HttpStatus enum) as an integer. |
HttpStatus |
getStatusCode()
Return the HTTP status code of the response.
|
String |
getStatusText()
Return the HTTP status text of the response.
|
getBody, getHeaders
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBody
getHeaders
public MockClientHttpResponse(byte[] body, HttpStatus statusCode)
public MockClientHttpResponse(InputStream body, HttpStatus statusCode)
public HttpStatus getStatusCode() throws IOException
ClientHttpResponse
getStatusCode
in interface ClientHttpResponse
IOException
- in case of I/O errorsHttpStatus.valueOf(int)
public int getRawStatusCode() throws IOException
ClientHttpResponse
HttpStatus
enum) as an integer.getRawStatusCode
in interface ClientHttpResponse
IOException
- in case of I/O errorsClientHttpResponse.getStatusCode()
public String getStatusText() throws IOException
ClientHttpResponse
getStatusText
in interface ClientHttpResponse
IOException
- in case of I/O errorspublic void close()
ClientHttpResponse
close
in interface Closeable
close
in interface AutoCloseable
close
in interface ClientHttpResponse