Add seeOther shortcut to ServerResponse.BodyBuilder

This commit is contained in:
Sebastien Deleuze
2017-03-13 11:32:49 +01:00
parent f84580c32d
commit 3c26e7f014
2 changed files with 22 additions and 0 deletions

View File

@@ -105,6 +105,17 @@ public class DefaultServerResponseBuilderTests {
}
@Test
public void seeOther() throws Exception {
URI location = URI.create("http://example.com");
Mono<ServerResponse> result = ServerResponse.seeOther(location).build();
StepVerifier.create(result)
.expectNextMatches(response -> HttpStatus.SEE_OTHER.equals(response.statusCode()) &&
location.equals(response.headers().getLocation()))
.expectComplete()
.verify();
}
@Test
public void temporaryRedirect() throws Exception {
URI location = URI.create("http://example.com");