Copy cookies and hints to ServerResponse builders
Closes gh-22351
This commit is contained in:
@@ -41,6 +41,7 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
|
||||
import org.springframework.mock.web.test.server.MockServerWebExchange;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.reactive.function.BodyInserters;
|
||||
import org.springframework.web.reactive.result.view.ViewResolver;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
@@ -302,6 +303,23 @@ public class DefaultServerResponseBuilderTests {
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void copyCookies() {
|
||||
Mono<ServerResponse> serverResponse = ServerResponse.ok()
|
||||
.cookie(ResponseCookie.from("foo", "bar").build())
|
||||
.syncBody("body");
|
||||
|
||||
assertFalse(serverResponse.block().cookies().isEmpty());
|
||||
|
||||
serverResponse = ServerResponse.ok()
|
||||
.cookie(ResponseCookie.from("foo", "bar").build())
|
||||
.body(BodyInserters.fromObject("body"));
|
||||
|
||||
|
||||
assertFalse(serverResponse.block().cookies().isEmpty());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void build() {
|
||||
ResponseCookie cookie = ResponseCookie.from("name", "value").build();
|
||||
|
||||
Reference in New Issue
Block a user