public class MockClientHttpRequest extends AbstractClientHttpRequest
ClientHttpRequest.| Constructor and Description |
|---|
MockClientHttpRequest(HttpMethod httpMethod,
java.lang.String urlTemplate,
java.lang.Object... vars) |
MockClientHttpRequest(HttpMethod httpMethod,
java.net.URI url) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
applyCookies()
Add cookies from
AbstractClientHttpRequest.getHeaders() to the underlying response. |
protected void |
applyHeaders()
Apply header changes from
AbstractClientHttpRequest.getHeaders() to the underlying response. |
DataBufferFactory |
bufferFactory()
Return a
DataBufferFactory that can be used to create the body. |
reactor.core.publisher.Flux<DataBuffer> |
getBody()
Return the request body, or an error stream if the body was never set
or when
setWriteHandler(java.util.function.Function<reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer>, reactor.core.publisher.Mono<java.lang.Void>>) is configured. |
HttpMethod |
getMethod()
Return the HTTP method of the request.
|
java.net.URI |
getURI()
Return the URI of the request.
|
reactor.core.publisher.Mono<java.lang.Void> |
setComplete()
Indicate that message handling is complete, allowing for any cleanup or
end-of-processing tasks to be performed such as applying header changes
made via
HttpMessage.getHeaders() to the underlying HTTP message (if not
applied already). |
void |
setWriteHandler(java.util.function.Function<reactor.core.publisher.Flux<DataBuffer>,reactor.core.publisher.Mono<java.lang.Void>> writeHandler)
Configure a custom handler for writing the request body.
|
reactor.core.publisher.Mono<java.lang.Void> |
writeAndFlushWith(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends DataBuffer>> body)
Use the given
Publisher of Publishers to write the body
of the HttpOutputMessage to the underlying HTTP layer, flushing after
each Publisher<DataBuffer>. |
reactor.core.publisher.Mono<java.lang.Void> |
writeWith(org.reactivestreams.Publisher<? extends DataBuffer> body)
Use the given
Publisher to write the body of the message to the
underlying HTTP layer. |
beforeCommit, doCommit, doCommit, getCookies, getHeaders, isCommittedpublic MockClientHttpRequest(HttpMethod httpMethod, java.lang.String urlTemplate, java.lang.Object... vars)
public MockClientHttpRequest(HttpMethod httpMethod, java.net.URI url)
public HttpMethod getMethod()
ClientHttpRequestpublic java.net.URI getURI()
ClientHttpRequestpublic DataBufferFactory bufferFactory()
ReactiveHttpOutputMessageDataBufferFactory that can be used to create the body.ReactiveHttpOutputMessage.writeWith(Publisher)public reactor.core.publisher.Flux<DataBuffer> getBody()
setWriteHandler(java.util.function.Function<reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer>, reactor.core.publisher.Mono<java.lang.Void>>) is configured.public void setWriteHandler(java.util.function.Function<reactor.core.publisher.Flux<DataBuffer>,reactor.core.publisher.Mono<java.lang.Void>> writeHandler)
The default write handler consumes and caches the request body so it may be accessed subsequently, e.g. in test assertions. Use this property when the request body is an infinite stream.
writeHandler - the write handler to use returning Mono<Void>
when the body has been "written" (i.e. consumed).protected void applyHeaders()
AbstractClientHttpRequestAbstractClientHttpRequest.getHeaders() to the underlying response.
This method is called once only.applyHeaders in class AbstractClientHttpRequestprotected void applyCookies()
AbstractClientHttpRequestAbstractClientHttpRequest.getHeaders() to the underlying response.
This method is called once only.applyCookies in class AbstractClientHttpRequestpublic reactor.core.publisher.Mono<java.lang.Void> writeWith(org.reactivestreams.Publisher<? extends DataBuffer> body)
ReactiveHttpOutputMessagePublisher to write the body of the message to the
underlying HTTP layer.body - the body content publisherMono that indicates completion or errorpublic reactor.core.publisher.Mono<java.lang.Void> writeAndFlushWith(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends DataBuffer>> body)
ReactiveHttpOutputMessagePublisher of Publishers to write the body
of the HttpOutputMessage to the underlying HTTP layer, flushing after
each Publisher<DataBuffer>.body - the body content publisherMono that indicates completion or errorpublic reactor.core.publisher.Mono<java.lang.Void> setComplete()
ReactiveHttpOutputMessageHttpMessage.getHeaders() to the underlying HTTP message (if not
applied already).
This method should be automatically invoked at the end of message processing so typically applications should not have to invoke it. If invoked multiple times it should have no side effects.
Mono that indicates completion or error