From c3a193c6a29afbe8a74de3cea56c8badbe3e8b69 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 18 Jul 2022 17:56:13 +0100 Subject: [PATCH] Polish HTTP cookies documentation See gh-592 --- docs/src/docs/asciidoc/documenting-your-api.adoc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/src/docs/asciidoc/documenting-your-api.adoc b/docs/src/docs/asciidoc/documenting-your-api.adoc index 9adae2ca..92cb7bd1 100644 --- a/docs/src/docs/asciidoc/documenting-your-api.adoc +++ b/docs/src/docs/asciidoc/documenting-your-api.adoc @@ -1037,7 +1037,13 @@ include::{examples-dir}/com/example/restassured/HttpCookies.java[tags=cookies] The result is a snippet named `request-cookies.adoc` and a snippet named `response-cookies.adoc`. Each contains a table describing the cookies. -When documenting HTTP Cookies, the test fails if a documented cookie is not found in the request or response. +When documenting HTTP cookies, the test fails if an undocumented cookie is found in the request or response. +Similarly, the test also fails if a documented cookie is not found and the cookie has not been marked as optional. +You can also document cookies in a relaxed mode, where any undocumented cookies do not cause a test failure. +To do so, use the `relaxedRequestCookies` and `relaxedResponseCookies` methods on `org.springframework.restdocs.cookies.CookieDocumentation`. +This can be useful when documenting a particular scenario where you only want to focus on a subset of the cookies. +If you do not want to document a cookie, you can mark it as ignored. +Doing so prevents it from appearing in the generated snippet while avoiding the failure described earlier.