Commit Graph

87 Commits

Author SHA1 Message Date
Andy Wilkinson
3161f10b51 Start testing against Spring Framework 5.3
Closes gh-695
2020-09-02 11:17:22 +01:00
Andy Wilkinson
513a0e9172 Tolerate breaking change in MockHttpServletRequestBuilder
Closes gh-675
2020-03-27 16:19:06 +00:00
Andy Wilkinson
1ee96bbb76 Make tests tolerate varying presence of Content-Length header
In Framework 5.2, the Content-Length is now provided by MockMvc. In
earlier versions it is not. This commit updates the tests to tolerate
this difference in behaviour so that the compatibility tests pass
again.
2019-12-18 17:43:35 +00:00
Andy Wilkinson
97ddf3dcec Fix handling of empty querty string parameters
Previously empty parameters in a query string were handled
inconsistently such that they sometimes had a value of "" in a list
and sometimes were represented as an empty list. This inconsistency
lead to the parameter appearing twice in the cURL request snippet.

This commit removes the inconsistency by always using an empty string
to represent an empty query parameter value.

Fixes gh-647
2019-10-04 18:34:56 +01:00
Andy Wilkinson
3a5cc58fab Test against Spring Framework 5.2 2019-09-15 15:03:50 +01:00
Andy Wilkinson
ef0973c548 Test against latest Framework 5.1 snapshot
This updates REST Docs to test against Framework's latest 5.1
snapshot. Due to a bug in the behaviour of HttpHeaders' key set [1],
HeaderRemovingOperationPreprocessor has been updated to no longer use
it when removing headers from a request or response prior to it being
documented.

[1] https://github.com/spring-projects/spring-framework/issues/22821
2019-09-14 17:38:29 +01:00
Andy Wilkinson
3597ebc35a Allow responses with non-standard status codes to be documented
Fixes gh-639
2019-09-12 17:03:21 +01:00
Andy Wilkinson
fce255695e Polish "Improve diagnostics for null configuration"
See gh-583
2019-08-30 17:14:42 +01:00
Dmytro Nosan
b5f2454c00 Improve diagnostics for null configuration
See gh-583
2019-08-30 17:09:27 +01:00
Andy Wilkinson
cc22dbfe26 Merge branch '1.2.x' 2019-08-30 11:20:34 +01:00
Andy Wilkinson
508b3d6593 Upgrade to Spring Java Format 0.0.15 2019-08-30 11:07:04 +01:00
Andy Wilkinson
09a4323ed5 Merge branch '1.2.x' 2019-03-19 11:42:23 +00:00
Andy Wilkinson
3282a798cb Merge branch '1.1.x' into 1.2.x 2019-03-19 11:35:06 +00:00
Andy Wilkinson
f7e61013bb Merge branch '1.0.x' into 1.1.x 2019-03-19 11:24:34 +00:00
Andy Wilkinson
75132b537a Use HTTPS to link to Apache license 2019-03-19 11:21:34 +00:00
Andy Wilkinson
fad2dff977 Merge branch '1.2.x' 2018-08-08 16:51:28 +01:00
Andy Wilkinson
244a734232 Adopt Spring Java Format for code formatting and style 2018-08-08 14:08:15 +01:00
Andy Wilkinson
ceb844183d Merge branch '1.2.x' 2018-08-08 12:27:43 +01:00
Andy Wilkinson
7431426cf3 Update tests to use AssertJ
Closes gh-537
2018-08-08 11:22:57 +01:00
Andy Wilkinson
a60b87990b Tolerate changes to request body reading in Framework 5.1
Previously, MockHttpServletRequest allowed its body to be ready
multiple times using its InputStream. As of recent Spring Framework
5.1 snapshots, this is no longer the case.

This commit moves to directly accessing the request's content as a
byte array using getContentAsByteArray() which was introduced in
Framework 5.0.

Closes gh-515
2018-06-17 12:55:56 +01:00
Andy Wilkinson
7f91d5f2e5 Merge branch '1.2.x' 2018-03-27 14:13:45 +01:00
Johnny Lim
da64c55fce Add HTTP method option unconditionally in curl command
Closes gh-488
2018-03-27 14:07:47 +01:00
Andy Wilkinson
e84aa86171 Merge branch '1.2.x' 2018-03-27 13:01:20 +01:00
Andy Wilkinson
95c4234c99 Format core code with Eclipse Oxygen's formatter 2018-03-27 12:53:34 +01:00
Andy Wilkinson
eed90c0b9a Polish "Add support for configuring default request and response preprocessors"
Closes gh-424
2017-10-27 12:09:56 +01:00
Filip Hrisafov
4f8b173836 Add support for configuring default request and response preprocessors
See gh-424
2017-10-27 12:09:56 +01:00
Andy Wilkinson
4e99df6b75 Merge branch '1.2.x' 2017-09-23 17:20:55 +01:00
Andy Wilkinson
7c6c2e7523 Polish 2017-09-23 17:20:03 +01:00
Andy Wilkinson
6986cb75a8 Remove deprecated code
Closes gh-387
2017-05-19 09:27:06 +02:00
Andy Wilkinson
41d537d06a Raise the minimum supported version of Spring Framework to 5.0
This commit upgrades to Spring Framework 5.0.0.RC1. It also upgrades
the Spring Boot-based samples to use Spring Boot 2.0.0.M1 which
supports Spring Framework 5. Lastly, it upgrades a number of
third-party dependencies to align with Spring Framework 5 and Spring
Boot 2.

Closes gh-386
2017-05-18 16:46:03 +02:00
Andy Wilkinson
d6eacfd819 Avoid duplicate cookies with Spring Framework 5's MockMvc
Closes gh-390
2017-04-26 11:57:18 +01:00
Andy Wilkinson
704257e93b Align generated Set-Cookie header with RFC 6265
Closes gh-378
2017-04-07 16:59:49 +01:00
Andy Wilkinson
a6d322007b Polish "Provide more control of formatting of curl and HTTPie commands"
See gh-348
Closes gh-260
2017-03-20 20:11:31 +00:00
Tomasz Kopczynski
2cb9d36ef1 Line breaks in cURL and HTTPie snippets
Closes gh-260
2017-03-20 20:11:31 +00:00
Andy Wilkinson
d486a16714 Reduce the complexity of MockMvcResponseConverter.generateSetCookieHeader 2017-03-13 21:28:20 +00:00
Andy Wilkinson
1b5e75ff2c Polish "Include cookies in the HTTP response snippet"
See gh-340
Closes gh-305
2017-03-13 20:46:05 +00:00
Tomasz Kopczynski
46190535f7 Include cookies in the HTTP response snippet
See gh-305
Closes gh-340
2017-03-13 20:44:33 +00:00
Andy Wilkinson
e9ceeacd66 Merge branch '1.1.x' 2017-03-04 21:05:07 +00:00
Andy Wilkinson
727f6ccd78 Protect the tests against changes to MockMvc's HTTP header ordering
Closes gh-359
2017-03-04 20:45:47 +00:00
Andy Wilkinson
722048e20f Introduce RequestCookie to avoid core depending on the Servlet API
Closes gh-345
2017-02-03 14:55:18 +00:00
Andy Wilkinson
a9c1e04081 Polish "Include cookies in request snippets"
See gh-336

Closes gh-302
Closes gh-303
Closes gh-304
2017-02-02 14:50:22 +00:00
Tomasz Kopczynski
25bc6c37da Include cookies in request snippets
Closes gh-336
See gh-302, gh-303, gh-304
2017-02-02 14:49:45 +00:00
Andy Wilkinson
677a23647f Compile and test against Spring Framework 4.3.6.RELEASE
This commit upgrade to Spring Framework 4.3.6.RELEASE. A side-effect
of this change is that the Content-Type header is now always the first
header when building a request with MockMvc. One test has been updated
to reflect this change in ordering.

Closes gh-342
2017-01-25 20:00:36 +00:00
Andy Wilkinson
cbd96f301d Update field snippets to no longer document whole subsection by default
Previously, when a field was documented it would implicitly document
the whole subsection of the payload identified by that field. This
could lead to users inadvertently failing to document part of the
payload. Arguably, this was a bug as it violated REST Docs' principle
of producing accurate, detail documentation. However, fixing it
requires a breaking change as people may also be relying on this
behaviour. A balance needed to be struck so the fix is being made in
a minor release.

This commit introduces a new subsectionWithPath method which returns a
SubsectionDescriptor; a specialisation of FieldDescriptor. Users
that were intentionally relying on the old behaviour will have to
replace some usage of fieldWithPath with subsectionWithPath instead.
Users who were unintentionally relying on the old behaviour will have
to add some additional descriptors produced using fieldWithPath and
will receive more accurate documentation in return.

Closes gh-274
2016-10-28 16:12:07 +01:00
Gerrit Meier
3ac4a1acad Provide a default output directory for snippets based on build tool
Rather than requiring an output directory to be explcitly configured,
a default is now automatically configured based on the build tool
that's being used. When using Gradle, snippets will be generated in
build/generated-snippets. When using Maven, snippets will be
generated in target/generated-snippets.

See gh-297
2016-10-21 22:26:58 +01:00
Andy Wilkinson
3ec945fe58 Make it clearer how to use RestDocumentationResultHandler.document
Closes gh-255
2016-07-22 14:30:09 +01:00
Andy Wilkinson
0a0136ca58 Move spring-webmvc dependency to where it's needed
Previously, spring-restdocs-core had a dependency on spring-webmvc
however it only used classes from spring-web. This commit moves
the spring-webmvc dependency from spring-restdocs-core to
spring-restdocs-mockmvc where it's needed. It's now in the runtime
scope (rather than compile) as it's not needed at compile time but
is needed at runtime by the MockMvc support in spring-test.

Closes gh-273
2016-07-05 12:49:17 +01:00
Andy Wilkinson
8ca1dfa1ad Improve handling of requests with both parameters and content
Previously, if a MockMvc request was made with parameters and body
content, the parameters were omitted from the resulting curl, HTTPie
and HTTP request snippets.

This commit updates the affected snippets to ensure that the
parameters are included. The user-provided content is interpreted
as indicating that the parameters should be sent in the query string
rather than as form-encoded content.

Closes gh-239
2016-06-23 17:53:32 +01:00
Andy Wilkinson
a4298b29e7 Include request URI’s port, if any, in default Host header
Previously, OperationRequestFactory would add a Host header if one did
not already exist in the request’s headers, however it did not include
the port. This meant that when the request was being made to a
non-standard port (a port other than 80 for an HTTP request and 443 for
an HTTPS request) the Host header was incorrect.

This commit updates OperationRequestFactory to check the URI for a port
and, if it has one, include it in the Host header.
UriModifyingOperationPreprocessor has also been updated to correctly
include the port in the Host header.

Closes gh-269
2016-06-23 15:45:11 +01:00
Andy Wilkinson
0446c99a10 Polishing
- Correct copyright years
- Add `@since` to javadoc of new public classes
- Make new classes final where appropriate
2016-05-25 11:26:02 +01:00