public class MockClientHttpResponse extends java.lang.Object implements ClientHttpResponse
ClientHttpResponse
.Modifier and Type | Field and Description |
---|---|
private <any> |
body |
private DataBufferFactory |
bufferFactory |
private MultiValueMap<java.lang.String,ResponseCookie> |
cookies |
private HttpHeaders |
headers |
private HttpStatus |
status |
Constructor and Description |
---|
MockClientHttpResponse(HttpStatus status) |
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
dumpString(DataBuffer buffer,
java.nio.charset.Charset charset) |
<any> |
getBody()
Return the body of the message as a
Publisher . |
<any> |
getBodyAsString()
Return the response body aggregated and converted to a String using the
charset of the Content-Type response or otherwise as "UTF-8".
|
private java.nio.charset.Charset |
getCharset() |
MultiValueMap<java.lang.String,ResponseCookie> |
getCookies()
Return a read-only map of response cookies received from the server.
|
HttpHeaders |
getHeaders()
Return the headers of this message.
|
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.
|
void |
setBody(<any> body) |
void |
setBody(java.lang.String body,
java.nio.charset.Charset charset) |
private DataBuffer |
toDataBuffer(java.lang.String body,
java.nio.charset.Charset charset) |
private final HttpStatus status
private final HttpHeaders headers
private final MultiValueMap<java.lang.String,ResponseCookie> cookies
private <any> body
private final DataBufferFactory bufferFactory
public MockClientHttpResponse(HttpStatus status)
public HttpStatus getStatusCode()
ClientHttpResponse
getStatusCode
in interface ClientHttpResponse
HttpStatus.valueOf(int)
public int getRawStatusCode()
ClientHttpResponse
HttpStatus
enum) as an integer.getRawStatusCode
in interface ClientHttpResponse
ClientHttpResponse.getStatusCode()
,
HttpStatus.resolve(int)
public HttpHeaders getHeaders()
HttpMessage
getHeaders
in interface HttpMessage
null
)public MultiValueMap<java.lang.String,ResponseCookie> getCookies()
ClientHttpResponse
getCookies
in interface ClientHttpResponse
public void setBody(<any> body)
public void setBody(java.lang.String body, java.nio.charset.Charset charset)
private DataBuffer toDataBuffer(java.lang.String body, java.nio.charset.Charset charset)
public <any> getBody()
ReactiveHttpInputMessage
Publisher
.getBody
in interface ReactiveHttpInputMessage
public <any> getBodyAsString()
private static java.lang.String dumpString(DataBuffer buffer, java.nio.charset.Charset charset)
private java.nio.charset.Charset getCharset()