Polish "Include cookies in the HTTP response snippet"

See gh-340
Closes gh-305
This commit is contained in:
Andy Wilkinson
2017-03-13 20:45:23 +00:00
parent 46190535f7
commit 1b5e75ff2c
5 changed files with 22 additions and 22 deletions

View File

@@ -274,19 +274,17 @@ public class RestAssuredRestDocumentationIntegrationTests {
given().port(tomcat.getPort())
.filter(documentationConfiguration(this.restDocumentation))
.filter(document("set-cookie",
preprocessResponse(removeHeaders(HttpHeaders.DATE, HttpHeaders.CONTENT_TYPE))))
preprocessResponse(removeHeaders(HttpHeaders.DATE,
HttpHeaders.CONTENT_TYPE))))
.get("/set-cookie").then().statusCode(200);
assertExpectedSnippetFilesExist(new File("build/generated-snippets/set-cookie"),
"http-request.adoc", "http-response.adoc", "curl-request.adoc");
assertThat(
new File("build/generated-snippets/set-cookie/http-response.adoc"),
assertThat(new File("build/generated-snippets/set-cookie/http-response.adoc"),
is(snippet(asciidoctor())
.withContents(httpResponse(asciidoctor(), HttpStatus.OK)
.header(HttpHeaders.SET_COOKIE, "name=value;domain=localhost;HttpOnly")
)
)
);
.withContents(httpResponse(asciidoctor(), HttpStatus.OK).header(
HttpHeaders.SET_COOKIE,
"name=value;domain=localhost;HttpOnly"))));
}
@Test

View File

@@ -113,7 +113,8 @@ class TomcatServer extends ExternalResource {
private static final class CookiesServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
Cookie cookie = new Cookie("name", "value");
cookie.setDomain("localhost");
cookie.setHttpOnly(true);