Class WebTestClientRestDocumentation
java.lang.Object
org.springframework.restdocs.webtestclient.WebTestClientRestDocumentation
Static factory methods for documenting RESTful APIs using WebFlux's
WebTestClient
.- Since:
- 2.0.0
- Author:
- Andy Wilkinson
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends org.springframework.test.web.reactive.server.ExchangeResult>
Consumer<T>document
(String identifier, OperationRequestPreprocessor requestPreprocessor, OperationResponsePreprocessor responsePreprocessor, Snippet... snippets) Documents the API call with the givenidentifier
using the givensnippets
in addition to any default snippets.static <T extends org.springframework.test.web.reactive.server.ExchangeResult>
Consumer<T>document
(String identifier, OperationRequestPreprocessor requestPreprocessor, Snippet... snippets) Documents the API call with the givenidentifier
using the givensnippets
in addition to any default snippets.static <T extends org.springframework.test.web.reactive.server.ExchangeResult>
Consumer<T>document
(String identifier, OperationResponsePreprocessor responsePreprocessor, Snippet... snippets) Documents the API call with the givenidentifier
using the givensnippets
in addition to any default snippets.static <T extends org.springframework.test.web.reactive.server.ExchangeResult>
Consumer<T>Returns aConsumer
that, when called, documents the API call with the givenidentifier
using the givensnippets
in addition to any default snippets.documentationConfiguration
(RestDocumentationContextProvider contextProvider) Provides access to aExchangeFilterFunction
that can be used to configure aWebTestClient
instance using the givencontextProvider
.
-
Method Details
-
documentationConfiguration
public static WebTestClientRestDocumentationConfigurer documentationConfiguration(RestDocumentationContextProvider contextProvider) Provides access to aExchangeFilterFunction
that can be used to configure aWebTestClient
instance using the givencontextProvider
.- Parameters:
contextProvider
- the context provider- Returns:
- the configurer
- See Also:
-
WebTestClient.Builder.filter(ExchangeFilterFunction)
-
document
public static <T extends org.springframework.test.web.reactive.server.ExchangeResult> Consumer<T> document(String identifier, Snippet... snippets) Returns aConsumer
that, when called, documents the API call with the givenidentifier
using the givensnippets
in addition to any default snippets.- Type Parameters:
T
- the type ofExchangeResult
that will be consumed- Parameters:
identifier
- an identifier for the API call that is being documentedsnippets
- the snippets- Returns:
- the
Consumer
that will document the API call represented by theExchangeResult
. - See Also:
-
WebTestClient.BodySpec.consumeWith(Consumer)
WebTestClient.BodyContentSpec.consumeWith(Consumer)
-
document
public static <T extends org.springframework.test.web.reactive.server.ExchangeResult> Consumer<T> document(String identifier, OperationRequestPreprocessor requestPreprocessor, Snippet... snippets) Documents the API call with the givenidentifier
using the givensnippets
in addition to any default snippets. The givenrequestPreprocessor
is applied to the request before it is documented.- Type Parameters:
T
- the type ofExchangeResult
that will be consumed- Parameters:
identifier
- an identifier for the API call that is being documentedrequestPreprocessor
- the request preprocessorsnippets
- the snippets- Returns:
- the
Consumer
that will document the API call represented by theExchangeResult
.
-
document
public static <T extends org.springframework.test.web.reactive.server.ExchangeResult> Consumer<T> document(String identifier, OperationResponsePreprocessor responsePreprocessor, Snippet... snippets) Documents the API call with the givenidentifier
using the givensnippets
in addition to any default snippets. The givenresponsePreprocessor
is applied to the request before it is documented.- Type Parameters:
T
- the type ofExchangeResult
that will be consumed- Parameters:
identifier
- an identifier for the API call that is being documentedresponsePreprocessor
- the response preprocessorsnippets
- the snippets- Returns:
- the
Consumer
that will document the API call represented by theExchangeResult
.
-
document
public static <T extends org.springframework.test.web.reactive.server.ExchangeResult> Consumer<T> document(String identifier, OperationRequestPreprocessor requestPreprocessor, OperationResponsePreprocessor responsePreprocessor, Snippet... snippets) Documents the API call with the givenidentifier
using the givensnippets
in addition to any default snippets. The givenrequestPreprocessor
andresponsePreprocessor
are applied to the request and response respectively before they are documented.- Type Parameters:
T
- the type ofExchangeResult
that will be consumed- Parameters:
identifier
- an identifier for the API call that is being documentedrequestPreprocessor
- the request preprocessorresponsePreprocessor
- the response preprocessorsnippets
- the snippets- Returns:
- the
Consumer
that will document the API call represented by theExchangeResult
.
-