public class MockServerHttpResponse
extends org.springframework.http.server.reactive.AbstractServerHttpResponse
ServerHttpResponse.| Constructor and Description |
|---|
MockServerHttpResponse() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
applyCookies() |
protected void |
applyHeaders() |
protected void |
applyStatusCode() |
reactor.core.publisher.Flux<org.springframework.core.io.buffer.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. |
reactor.core.publisher.Mono<String> |
getBodyAsString()
Shortcut method that delegates to
getBody() and then aggregates
the data buffers and converts to a String using the charset of the
Content-Type header or falling back on "UTF-8" by default. |
reactor.core.publisher.Mono<Void> |
setComplete() |
void |
setWriteHandler(Function<reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer>,reactor.core.publisher.Mono<Void>> writeHandler)
Configure a custom handler for writing the request body.
|
protected reactor.core.publisher.Mono<Void> |
writeAndFlushWithInternal(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends org.springframework.core.io.buffer.DataBuffer>> body) |
protected reactor.core.publisher.Mono<Void> |
writeWithInternal(org.reactivestreams.Publisher<? extends org.springframework.core.io.buffer.DataBuffer> body) |
public reactor.core.publisher.Flux<org.springframework.core.io.buffer.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 reactor.core.publisher.Mono<String> getBodyAsString()
getBody() and then aggregates
the data buffers and converts to a String using the charset of the
Content-Type header or falling back on "UTF-8" by default.public void setWriteHandler(Function<reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer>,reactor.core.publisher.Mono<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 applyStatusCode()
applyStatusCode in class org.springframework.http.server.reactive.AbstractServerHttpResponseprotected void applyHeaders()
applyHeaders in class org.springframework.http.server.reactive.AbstractServerHttpResponseprotected void applyCookies()
applyCookies in class org.springframework.http.server.reactive.AbstractServerHttpResponseprotected reactor.core.publisher.Mono<Void> writeWithInternal(org.reactivestreams.Publisher<? extends org.springframework.core.io.buffer.DataBuffer> body)
writeWithInternal in class org.springframework.http.server.reactive.AbstractServerHttpResponseprotected reactor.core.publisher.Mono<Void> writeAndFlushWithInternal(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends org.springframework.core.io.buffer.DataBuffer>> body)
writeAndFlushWithInternal in class org.springframework.http.server.reactive.AbstractServerHttpResponsepublic reactor.core.publisher.Mono<Void> setComplete()
setComplete in interface org.springframework.http.ReactiveHttpOutputMessagesetComplete in class org.springframework.http.server.reactive.AbstractServerHttpResponse