Andy Wilkinson 0d2c24ccc1 Improve curl request snippet's handling of query parameters
Previously, if a request had no content and it was a POST or a PUT
request, the curl request snippet would use the request's parameters
as application/x-www-form-urlencoded data sent using the -d option.
This resulted in the wrong snippet being produced if those parameters
had actually come from the request's query string.

This commit enhances CurlRequestSnippet so that, when it's using the
request's parameter's to create its content, it only includes
parameters that are not specified in the query string. With these
changes in place, this MockMvc request:

post("/?foo=bar").param("foo", "bar").param("a", "alpha")

Will produce a curl snippet with the following command:

$ curl 'http://localhost:8080/?foo=bar' -i -X POST -d 'a=alpha'

foo=bar only appears in the command's query string, despite also
being a general request parameter, and a=alpha only appears in the
request's data.

Closes gh-139
2015-09-28 17:23:22 +01:00
2014-10-08 14:04:52 +01:00

Spring REST Docs Build status

Overview

The primary goal of this project is to make it easy to document RESTful services by combining content that's been hand-written using Asciidoctor with auto-generated examples produced with the Spring MVC Test framework. The result is intended to be an easy-to-read user guide, akin to GitHub's API documentation for example, rather than the fully automated, dense API documentation produced by tools like Swagger.

For a broader introduction see the Documenting RESTful APIs presentation. Both the slides and a video recording are available.

Learning more

To learn more about Spring REST Docs, please consult the reference documentation.

Building from source

Spring REST Docs requires Java 7 or later and is built using Gradle:

./gradlew build

Contributing

Pull requests are welcome. Please see the contributor guidelines for details.

Licence

Spring REST Docs is open source software released under the Apache 2.0 license.

Description
No description provided
Readme 6.8 MiB
Languages
Java 98.2%
Groovy 1.3%
Vim Snippet 0.5%