Class MockClientHttpResponse
java.lang.Object
org.springframework.mock.http.client.reactive.MockClientHttpResponse
- All Implemented Interfaces:
ClientHttpResponse
,HttpMessage
,ReactiveHttpInputMessage
Mock implementation of
ClientHttpResponse
.- Since:
- 5.0
- Author:
- Brian Clozel, Rossen Stoyanchev
-
Constructor Summary
ConstructorDescriptionMockClientHttpResponse
(int status) MockClientHttpResponse
(HttpStatusCode status) -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Flux<DataBuffer>
getBody()
Return the body of the message as aPublisher
.reactor.core.publisher.Mono<String>
Return the response body aggregated and converted to a String using the charset of the Content-Type response or otherwise as "UTF-8".Return a read-only map of response cookies received from the server.Return the headers of this message.Return the HTTP status code as anHttpStatusCode
.void
void
void
setBody
(Publisher<DataBuffer> body) toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.http.client.reactive.ClientHttpResponse
getId, getRawStatusCode
-
Constructor Details
-
MockClientHttpResponse
public MockClientHttpResponse(int status) -
MockClientHttpResponse
-
-
Method Details
-
getStatusCode
Description copied from interface:ClientHttpResponse
Return the HTTP status code as anHttpStatusCode
.- Specified by:
getStatusCode
in interfaceClientHttpResponse
- Returns:
- the HTTP status as
HttpStatusCode
value (nevernull
)
-
getHeaders
Description copied from interface:HttpMessage
Return the headers of this message.- Specified by:
getHeaders
in interfaceHttpMessage
- Returns:
- a corresponding HttpHeaders object (never
null
)
-
getCookies
Description copied from interface:ClientHttpResponse
Return a read-only map of response cookies received from the server.- Specified by:
getCookies
in interfaceClientHttpResponse
-
setBody
-
setBody
-
setBody
-
getBody
Description copied from interface:ReactiveHttpInputMessage
Return the body of the message as aPublisher
.- Specified by:
getBody
in interfaceReactiveHttpInputMessage
- Returns:
- the body content publisher
-
getBodyAsString
Return the response body aggregated and converted to a String using the charset of the Content-Type response or otherwise as "UTF-8". -
toString
-