spring-framework / org.springframework.test.web.reactive.server

Package org.springframework.test.web.reactive.server

Types

ExchangeResult

open class ExchangeResult

Container for request and response details for exchanges performed through WebTestClient.

Note that a decoded response body is not exposed at this level since the body may not have been decoded and consumed yet. Sub-types EntityExchangeResult and FluxExchangeResult provide access to a decoded response entity and a decoded (but not consumed) response body respectively.

HttpHandlerConnector

open class HttpHandlerConnector : ClientHttpConnector

Connector that handles requests by invoking an HttpHandler rather than making actual requests to a network socket.

Internally the connector uses and adapts MockClientHttpRequest and MockClientHttpResponse to MockServerHttpRequest and MockServerHttpResponse.

JsonPathAssertions

open class JsonPathAssertions

JsonPath assertions.

MockServerConfigurer

interface MockServerConfigurer

Contract that frameworks or applications can use to pre-package a set of customizations to a WebTestClient.MockServerSpec and expose that as a shortcut.

An implementation of this interface can be plugged in via WebTestClient.MockServerSpec#apply where instances are likely obtained via static methods, e.g.:

 import static org.example.ExampleSetup.securitySetup; // ... WebTestClient.bindToController(new TestController()) .apply(securitySetup("foo","bar")) .build(); 

Functions

body

fun <T : Any, S : Publisher<T>> RequestBodySpec.body(publisher: S): RequestHeadersSpec<*>

Extension for RequestBodySpec.body providing a variant without explicit class parameter thanks to Kotlin reified type parameters.

expectBody

fun <B : Any> ResponseSpec.expectBody(): BodySpec<B, *>

Extension for ResponseSpec.expectBody providing a expectBody<Foo>() variant.

expectBodyList

fun <E : Any> ResponseSpec.expectBodyList(): ListBodySpec<E>

Extension for ResponseSpec.expectBodyList providing a expectBodyList<Foo>() variant.

returnResult

fun <T : Any> ResponseSpec.returnResult(): FluxExchangeResult<T>

Extension for ResponseSpec.returnResult providing a returnResult<Foo>() variant.