Class MockServerHttpResponse

    • Constructor Detail

      • MockServerHttpResponse

        public MockServerHttpResponse()
    • Method Detail

      • setWriteHandler

        public void setWriteHandler(java.util.function.Function<reactor.core.publisher.Flux<DataBuffer>,reactor.core.publisher.Mono<java.lang.Void>> writeHandler)
        Configure a custom handler to consume the response body.

        By default, response body content is consumed in full and cached for subsequent access in tests. Use this option to take control over how the response body is consumed.

        writeHandler - the write handler to use returning Mono<Void> when the body has been "written" (i.e. consumed).
      • writeAndFlushWithInternal

        protected reactor.core.publisher.Mono<java.lang.Void> writeAndFlushWithInternal(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends DataBuffer>> body)
        Description copied from class: AbstractServerHttpResponse
        Write to the underlying the response, and flush after each Publisher<DataBuffer>.
        Specified by:
        writeAndFlushWithInternal in class AbstractServerHttpResponse
        body - the publisher to write and flush with
      • setComplete

        public reactor.core.publisher.Mono<java.lang.Void> setComplete()
        Description copied from interface: ReactiveHttpOutputMessage
        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).

        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.

        Specified by:
        setComplete in interface ReactiveHttpOutputMessage
        setComplete in class AbstractServerHttpResponse
        a Mono that indicates completion or error
      • getBody

        public reactor.core.publisher.Flux<DataBuffer> getBody()
        Return the response body or an error stream if the body was not set.
      • getBodyAsString

        public reactor.core.publisher.Mono<java.lang.String> getBodyAsString()
        Aggregate response data and convert to a String using the "Content-Type" charset or "UTF-8" by default.