Document how to configure URIs when using WebTestClient

Closes gh-455
This commit is contained in:
Andy Wilkinson
2017-11-12 17:48:21 +00:00
parent 0f0769245d
commit 6912977b87
3 changed files with 26 additions and 6 deletions

View File

@@ -6,10 +6,10 @@
[[configuration-uris]]
=== Documented URIs
NOTE: As REST Assured tests a service by making actual HTTP requests, the documented
URIs cannot be customized in this way. You should use the
<<customizing-requests-and-responses-preprocessors-modify-uris, REST-Assured specific
preprocessor>> instead.
[[configuration-uris-mockmvc]]
==== MockMvc URI customization
When using MockMvc, the default configuration for URIs documented by Spring REST Docs is:
@@ -42,6 +42,25 @@ TIP: To configure a request's context path, use the `contextPath` method on
[[configuration-uris-rest-assured]]
==== REST Assured URI customization
REST Assured tests a service by making actual HTTP requests. As a result, URIs must be
customized once the operation on the service has been performed but before it is
documented. A <<customizing-requests-and-responses-preprocessors-modify-uris, REST-Assured
specific preprocessor>> is provided for this purpose.
[[configuration-uris-webtestclient]]
==== WebTestClient URI customization
When using WebTestClient, the documented URIs can be customized using the
{spring-framework-api}/org/springframework/test/web/reactive/server/WebTestClient.Builder.html#baseUrl-java.lang.String-[
`baseUrl(String)` method on `WebTestClient.Builder`].
[[configuration-snippet-encoding]]
=== Snippet encoding

View File

@@ -143,8 +143,8 @@ parameters.
[[customizing-requests-and-responses-preprocessors-modify-uris]]
==== Modifying URIs
TIP: If you are using MockMvc, URIs should be customized by <<configuration-uris, changing
the configuration>>.
TIP: If you are using MockMvc or WebTestclient, URIs should be customized by
<<configuration-uris, changing the configuration>>.
`modifyUris` on `RestAssuredPreprocessors` can be used to modify any URIs in a request
or a response. When using REST Assured, this allows you to customize the URIs that appear

View File

@@ -14,6 +14,7 @@ Andy Wilkinson
:templates: {source}spring-restdocs/src/main/resources/org/springframework/restdocs/templates
:spring-boot-docs: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle
:spring-framework-docs: https://docs.spring.io/spring-framework/docs/5.0.x/spring-framework-reference
:spring-framework-api: https://docs.spring.io/spring-framework/docs/5.0.x/javadoc-api
[[abstract]]