Polish "Include cookies in the HTTP response snippet"
See gh-340 Closes gh-305
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user