Validate that the code is 3xx

This commit is contained in:
Spencer Gibb
2017-08-21 14:07:53 -06:00
parent 3fe32ecce5
commit 47b391c72f

View File

@@ -27,6 +27,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.tuple.Tuple;
import org.springframework.util.Assert;
import org.springframework.web.server.WebFilter;
import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.parse;
@@ -53,6 +54,7 @@ public class RedirectToWebFilterFactory implements WebFilterFactory {
String urlString = args.getString(URL_KEY);
final HttpStatus httpStatus = parse(statusString);
Assert.isTrue(httpStatus.is3xxRedirection(), "status must be a 3xx code, but was " + statusString);
final URL url;
try {
url = URI.create(urlString).toURL();