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 givenidentifierusing the givensnippetsin 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 givenidentifierusing the givensnippetsin 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 givenidentifierusing the givensnippetsin addition to any default snippets.static <T extends org.springframework.test.web.reactive.server.ExchangeResult>
Consumer<T>Returns aConsumerthat, when called, documents the API call with the givenidentifierusing the givensnippetsin addition to any default snippets.documentationConfiguration(RestDocumentationContextProvider contextProvider) Provides access to aExchangeFilterFunctionthat can be used to configure aWebTestClientinstance using the givencontextProvider.
-
Method Details
-
documentationConfiguration
public static WebTestClientRestDocumentationConfigurer documentationConfiguration(RestDocumentationContextProvider contextProvider) Provides access to aExchangeFilterFunctionthat can be used to configure aWebTestClientinstance 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 aConsumerthat, when called, documents the API call with the givenidentifierusing the givensnippetsin addition to any default snippets.- Type Parameters:
T- the type ofExchangeResultthat will be consumed- Parameters:
identifier- an identifier for the API call that is being documentedsnippets- the snippets- Returns:
- the
Consumerthat 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 givenidentifierusing the givensnippetsin addition to any default snippets. The givenrequestPreprocessoris applied to the request before it is documented.- Type Parameters:
T- the type ofExchangeResultthat will be consumed- Parameters:
identifier- an identifier for the API call that is being documentedrequestPreprocessor- the request preprocessorsnippets- the snippets- Returns:
- the
Consumerthat 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 givenidentifierusing the givensnippetsin addition to any default snippets. The givenresponsePreprocessoris applied to the request before it is documented.- Type Parameters:
T- the type ofExchangeResultthat will be consumed- Parameters:
identifier- an identifier for the API call that is being documentedresponsePreprocessor- the response preprocessorsnippets- the snippets- Returns:
- the
Consumerthat 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 givenidentifierusing the givensnippetsin addition to any default snippets. The givenrequestPreprocessorandresponsePreprocessorare applied to the request and response respectively before they are documented.- Type Parameters:
T- the type ofExchangeResultthat 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
Consumerthat will document the API call represented by theExchangeResult.
-