Skip to content

Commit e78998d

Browse files
committed
Merge branch '2.0.x'
# Conflicts: # docs/src/docs/asciidoc/configuration.adoc # docs/src/docs/asciidoc/customizing-requests-and-responses.adoc # docs/src/docs/asciidoc/documenting-your-api.adoc # docs/src/docs/asciidoc/getting-started.adoc
2 parents adbc880 + 232f581 commit e78998d

8 files changed

+52
-109
lines changed

docs/src/docs/asciidoc/configuration.adoc

+6-8
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33

44
This section covers how to configure Spring REST Docs.
55

6+
7+
68
[[configuration-uris]]
79
=== Documented URIs
810

911
This section covers configuring documented URIs.
1012

13+
14+
1115
[[configuration-uris-mockmvc]]
1216
==== MockMvc URI Customization
1317

@@ -30,12 +34,10 @@ This configuration is applied by `MockMvcRestDocumentationConfigurer`.
3034
You can use its API to change one or more of the defaults to suit your needs.
3135
The following example shows how to do so:
3236

33-
====
3437
[source,java,indent=0]
3538
----
3639
include::{examples-dir}/com/example/mockmvc/CustomUriConfiguration.java[tags=custom-uri-configuration]
3740
----
38-
====
3941

4042
NOTE: If the port is set to the default for the configured scheme (port 80 for HTTP or port 443 for HTTPS), it is omitted from any URIs in the generated snippets.
4143

@@ -50,13 +52,11 @@ When using WebTestClient, the default base for URIs documented by Spring REST Do
5052
You can customize this base by using the {spring-framework-api}/org/springframework/test/web/reactive/server/WebTestClient.Builder.html#baseUrl-java.lang.String-[ `baseUrl(String)` method on `WebTestClient.Builder`].
5153
The following example shows how to do so:
5254

53-
====
5455
[source,java,indent=0]
5556
----
5657
include::{examples-dir}/com/example/webtestclient/CustomUriConfiguration.java[tags=custom-uri-configuration]
5758
----
5859
<1> Configure the base of documented URIs to be `https://api.example.com`.
59-
====
6060

6161

6262

@@ -67,7 +67,6 @@ The default snippet encoding is `UTF-8`.
6767
You can change the default snippet encoding by using the `RestDocumentationConfigurer` API.
6868
For example, the following examples use `ISO-8859-1`:
6969

70-
====
7170
[source,java,indent=0,role="primary"]
7271
.MockMvc
7372
----
@@ -94,7 +93,6 @@ Markdown is also supported out of the box.
9493
You can change the default format by using the `RestDocumentationConfigurer` API.
9594
The following examples show how to do so:
9695

97-
====
9896
[source,java,indent=0,role="primary"]
9997
.MockMvc
10098
----
@@ -124,7 +122,6 @@ Six snippets are produced by default:
124122
You can change the default snippet configuration during setup by using the `RestDocumentationConfigurer` API.
125123
The following examples produce only the `curl-request` snippet by default:
126124

127-
====
128125
[source,java,indent=0,role="primary"]
129126
.MockMvc
130127
----
@@ -145,7 +142,6 @@ include::{examples-dir}/com/example/webtestclient/CustomDefaultSnippets.java[tag
145142
You can configure default request and response preprocessors during setup by using the `RestDocumentationConfigurer` API.
146143
The following examples remove the `Foo` headers from all requests and pretty print all responses:
147144

148-
====
149145
[source,java,indent=0,role="primary"]
150146
.MockMvc
151147
----
@@ -161,3 +157,5 @@ include::{examples-dir}/com/example/webtestclient/CustomDefaultOperationPreproce
161157
----
162158
<1> Apply a request preprocessor that removes the header named `Foo`.
163159
<2> Apply a response preprocessor that pretty prints its content.
160+
161+

docs/src/docs/asciidoc/contributing.adoc

+2
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ If you would like an enhancement to be made to Spring REST Docs, pull requests a
2929
The source code is on {github}[GitHub].
3030
You may want to search the {github}/issues?q=is%3Aissue[existing issues] and {github}/pulls?q=is%3Apr[pull requests] to see if the enhancement has already been proposed.
3131
You may also want to {github}/issues/new[open a new issue] to discuss a possible enhancement before work on it begins.
32+
33+

docs/src/docs/asciidoc/customizing-requests-and-responses.adoc

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Preprocessing is configured by calling `document` with an `OperationRequestPrepr
88
You can obtain instances by using the static `preprocessRequest` and `preprocessResponse` methods on `Preprocessors`.
99
The following examples show how to do so:
1010

11-
====
1211
[source,java,indent=0,role="primary"]
1312
.MockMvc
1413
----
@@ -29,7 +28,6 @@ Alternatively, you may want to apply the same preprocessors to every test.
2928
You can do so by using the `RestDocumentationConfigurer` API in your `@Before` method to configure the preprocessors.
3029
For example, to remove the `Foo` header from all requests and pretty print all responses, you could do one of the following (depending on your testing environment):
3130

32-
====
3331
[source,java,indent=0,role="primary"]
3432
.MockMvc
3533
----
@@ -49,7 +47,6 @@ include::{examples-dir}/com/example/webtestclient/EveryTestPreprocessing.java[ta
4947
Then, in each test, you can perform any configuration specific to that test.
5048
The following examples show how to do so:
5149

52-
====
5350
[source,java,indent=0,role="primary"]
5451
.MockMvc
5552
----
@@ -130,3 +127,5 @@ If one of the built-in preprocessors does not meet your needs, you can write you
130127
You can then use your custom preprocessor in exactly the same way as any of the built-in preprocessors.
131128

132129
If you want to modify only the content (body) of a request or response, consider implementing the `ContentModifier` interface and using it with the built-in `ContentModifyingOperationPreprocessor`.
130+
131+

0 commit comments

Comments
 (0)