Align generated Set-Cookie header with RFC 6265
Closes gh-378
This commit is contained in:
@@ -73,15 +73,15 @@ class MockMvcResponseConverter implements ResponseConverter<MockHttpServletRespo
|
||||
header.append(maxAge);
|
||||
}
|
||||
|
||||
appendIfAvailable(header, ";domain=", cookie.getDomain());
|
||||
appendIfAvailable(header, ";path=", cookie.getPath());
|
||||
appendIfAvailable(header, "; Domain=", cookie.getDomain());
|
||||
appendIfAvailable(header, "; Path=", cookie.getPath());
|
||||
|
||||
if (cookie.getSecure()) {
|
||||
header.append(";Secure");
|
||||
header.append("; Secure");
|
||||
}
|
||||
|
||||
if (cookie.isHttpOnly()) {
|
||||
header.append(";HttpOnly");
|
||||
header.append("; HttpOnly");
|
||||
}
|
||||
|
||||
return header.toString();
|
||||
|
||||
@@ -68,6 +68,6 @@ public class MockMvcResponseConverterTests {
|
||||
assertThat(operationResponse.getHeaders().size(), is(1));
|
||||
assertTrue(operationResponse.getHeaders().containsKey(HttpHeaders.SET_COOKIE));
|
||||
assertThat(operationResponse.getHeaders().get(HttpHeaders.SET_COOKIE), equalTo(
|
||||
Collections.singletonList("name=value;domain=localhost;HttpOnly")));
|
||||
Collections.singletonList("name=value; Domain=localhost; HttpOnly")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ public class MockMvcRestDocumentationIntegrationTests {
|
||||
is(snippet(asciidoctor())
|
||||
.withContents(httpResponse(asciidoctor(), HttpStatus.OK).header(
|
||||
HttpHeaders.SET_COOKIE,
|
||||
"name=value;domain=localhost;HttpOnly"))));
|
||||
"name=value; Domain=localhost; HttpOnly"))));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -7,7 +7,7 @@ dependencies {
|
||||
|
||||
testCompile 'com.jayway.restassured:rest-assured'
|
||||
testCompile 'io.rest-assured:rest-assured'
|
||||
testCompile 'org.apache.tomcat.embed:tomcat-embed-core:8.5.11'
|
||||
testCompile 'org.apache.tomcat.embed:tomcat-embed-core:8.5.13'
|
||||
testCompile 'org.mockito:mockito-core'
|
||||
testCompile 'org.hamcrest:hamcrest-library'
|
||||
testCompile project(path: ':spring-restdocs-core', configuration: 'testArtifacts')
|
||||
|
||||
@@ -289,7 +289,7 @@ public class RestAssuredRestDocumentationIntegrationTests {
|
||||
is(snippet(asciidoctor())
|
||||
.withContents(httpResponse(asciidoctor(), HttpStatus.OK).header(
|
||||
HttpHeaders.SET_COOKIE,
|
||||
"name=value;domain=localhost;HttpOnly"))));
|
||||
"name=value; Domain=localhost; HttpOnly"))));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -288,7 +288,7 @@ public class RestAssuredRestDocumentationIntegrationTests {
|
||||
is(snippet(asciidoctor())
|
||||
.withContents(httpResponse(asciidoctor(), HttpStatus.OK).header(
|
||||
HttpHeaders.SET_COOKIE,
|
||||
"name=value;domain=localhost;HttpOnly"))));
|
||||
"name=value; Domain=localhost; HttpOnly"))));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user