Class MockClientHttpResponse
java.lang.Object
org.springframework.mock.http.MockHttpInputMessage
org.springframework.mock.http.client.MockClientHttpResponse
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- ClientHttpResponse,- HttpInputMessage,- HttpMessage
Mock implementation of 
ClientHttpResponse.- Since:
- 3.2
- Author:
- Rossen Stoyanchev
- 
Constructor SummaryConstructorsConstructorDescriptionMockClientHttpResponse(byte[] body, int statusCode) Variant ofMockClientHttpResponse(byte[], HttpStatusCode)with a custom HTTP status code.MockClientHttpResponse(byte[] body, HttpStatusCode statusCode) Constructor with response body as a byte array.MockClientHttpResponse(InputStream body, int statusCode) Variant ofMockClientHttpResponse(InputStream, HttpStatusCode)with a custom HTTP status code.MockClientHttpResponse(InputStream body, HttpStatusCode statusCode) Constructor with response body as InputStream.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Close this response, freeing any resources created.intDeprecated.Get the HTTP status code as anHttpStatusCode.Get the HTTP status text of the response.Methods inherited from class org.springframework.mock.http.MockHttpInputMessagegetBody, getHeadersMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.http.HttpInputMessagegetBodyMethods inherited from interface org.springframework.http.HttpMessagegetHeaders
- 
Constructor Details- 
MockClientHttpResponseConstructor with response body as a byte array.
- 
MockClientHttpResponsepublic MockClientHttpResponse(byte[] body, int statusCode) Variant ofMockClientHttpResponse(byte[], HttpStatusCode)with a custom HTTP status code.- Since:
- 5.3.17
 
- 
MockClientHttpResponseConstructor with response body as InputStream.
- 
MockClientHttpResponseVariant ofMockClientHttpResponse(InputStream, HttpStatusCode)with a custom HTTP status code.- Since:
- 5.3.17
 
 
- 
- 
Method Details- 
getStatusCodeDescription copied from interface:ClientHttpResponseGet the HTTP status code as anHttpStatusCode.- Specified by:
- getStatusCodein interface- ClientHttpResponse
- Returns:
- the HTTP status as HttpStatusCodevalue (nevernull)
 
- 
getRawStatusCodeDeprecated.Description copied from interface:ClientHttpResponseGet the HTTP status code as an integer.- Specified by:
- getRawStatusCodein interface- ClientHttpResponse
- Returns:
- the HTTP status as an integer value
- See Also:
 
- 
getStatusTextDescription copied from interface:ClientHttpResponseGet the HTTP status text of the response.- Specified by:
- getStatusTextin interface- ClientHttpResponse
- Returns:
- the HTTP status text
 
- 
closepublic void close()Description copied from interface:ClientHttpResponseClose this response, freeing any resources created.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- ClientHttpResponse
- Specified by:
- closein interface- Closeable
 
 
-