Skip to content

Commit b6df324

Browse files
committed
Document how to specify query parameters when testing with MockMvc
Closes gh-926
1 parent d4bb3b3 commit b6df324

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

docs/src/docs/asciidoc/documenting-your-api.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,11 +661,13 @@ The following examples show how to do so:
661661
include::{examples-dir}/com/example/mockmvc/QueryParameters.java[tags=query-parameters]
662662
----
663663
<1> Perform a `GET` request with two parameters, `page` and `per_page`, in the query string.
664+
Query parameters should be included in the URL, as shown here, or specified using the request builder's `queryParam` or `queryParams` method.
665+
The `param` and `params` methods should be avoided as the source of the parameters is then ambiguous.
664666
<2> Configure Spring REST Docs to produce a snippet describing the request's query parameters.
665667
Uses the static `queryParameters` method on `org.springframework.restdocs.request.RequestDocumentation`.
666-
<3> Document the `page` parameter.
668+
<3> Document the `page` query parameter.
667669
Uses the static `parameterWithName` method on `org.springframework.restdocs.request.RequestDocumentation`.
668-
<4> Document the `per_page` parameter.
670+
<4> Document the `per_page` query parameter.
669671

670672
[source,java,indent=0,role="secondary"]
671673
.WebTestClient

0 commit comments

Comments
 (0)