T - the type of elements in the response bodypublic class FluxExchangeResult<T> extends ExchangeResult
ExchangeResult variant with the response body decoded as
Flux<T> but not yet consumed.EntityExchangeResult| Modifier and Type | Method and Description |
|---|---|
reactor.core.publisher.Flux<T> |
getResponseBody()
Return the response body as a
Flux<T> of decoded elements. |
byte[] |
getResponseBodyContent()
Return the raw request body content written as a
byte[]. |
assertWithDiagnostics, getMethod, getRequestBodyContent, getRequestHeaders, getResponseCookies, getResponseHeaders, getStatus, getUrl, toStringpublic reactor.core.publisher.Flux<T> getResponseBody()
Flux<T> of decoded elements.
The response body stream can then be consumed further with the
"reactor-test" StepVerifier and cancelled when enough elements have been
consumed from the (possibly infinite) stream:
FluxExchangeResultresult = this.client.get() .uri("/persons") .accept(TEXT_EVENT_STREAM) .exchange() .expectStatus().isOk() .expectHeader().contentType(TEXT_EVENT_STREAM) .expectBody(Person.class) .returnResult(); StepVerifier.create(result.getResponseBody()) .expectNext(new Person("Jane"), new Person("Jason")) .expectNextCount(4) .expectNext(new Person("Jay")) .thenCancel() .verify();
public byte[] getResponseBodyContent()
byte[].
Note: this method should typically be called after
the response has been consumed in full via getResponseBody().
Calling it first will cause the response Flux<T> to be consumed
via getResponseBody.ignoreElements().
getResponseBodyContent in class ExchangeResult