Copy cookies in built ServerResponse

Closes gh-22481
This commit is contained in:
Arjen Poutsma
2019-03-26 15:47:58 +01:00
parent dba04a7338
commit 0db317575b
2 changed files with 7 additions and 1 deletions

View File

@@ -71,10 +71,15 @@ public class DefaultServerResponseBuilderTests {
@Test
public void from() {
ServerResponse other = ServerResponse.ok().header("foo", "bar").build();
Cookie cookie = new Cookie("foo", "bar");
ServerResponse other = ServerResponse.ok()
.header("foo", "bar")
.cookie(cookie)
.build();
ServerResponse result = ServerResponse.from(other).build();
assertEquals(HttpStatus.OK, result.statusCode());
assertEquals("bar", result.headers().getFirst("foo"));
assertEquals(cookie, result.cookies().getFirst("foo"));
}