Merge remote-tracking branch 'spring-operator/polish-urls-remaining-2.0.x' into 2.0.x
This commit is contained in:
@@ -51,7 +51,7 @@ import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.G
|
||||
import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.containsEncodedParts;
|
||||
|
||||
/**
|
||||
* Depends on `spring-cloud-starter-netflix-hystrix`, {@see http://cloud.spring.io/spring-cloud-netflix/}
|
||||
* Depends on `spring-cloud-starter-netflix-hystrix`, {@see https://cloud.spring.io/spring-cloud-netflix/}
|
||||
* @author Spencer Gibb
|
||||
* @author Michele Mancioppi
|
||||
*/
|
||||
|
||||
@@ -189,7 +189,7 @@ public class GatewayFilterSpec extends UriSpec {
|
||||
/**
|
||||
* Wraps the route in a Hystrix command.
|
||||
* Depends on @{code org.springframework.cloud::spring-cloud-starter-netflix-hystrix} being on the classpath,
|
||||
* {@see http://cloud.spring.io/spring-cloud-netflix/}
|
||||
* {@see https://cloud.spring.io/spring-cloud-netflix/}
|
||||
* @param configConsumer a {@link Consumer} which provides configuration for the Hystrix command
|
||||
* @return a {@link GatewayFilterSpec} that can be used to apply additional filters
|
||||
*/
|
||||
@@ -531,9 +531,9 @@ public class GatewayFilterSpec extends UriSpec {
|
||||
|
||||
/**
|
||||
* A filter which forces a {@code WebSession::save} operation before forwarding the call downstream. This is of
|
||||
* particular use when using something like <a href="http://projects.spring.io/spring-session/">Spring Session</a>
|
||||
* particular use when using something like <a href="https://projects.spring.io/spring-session/">Spring Session</a>
|
||||
* with a lazy data store and need to ensure the session state has been saved before making the forwarded call.
|
||||
* If you are integrating <a href="http://projects.spring.io/spring-security/">Spring Security</a> with
|
||||
* If you are integrating <a href="https://projects.spring.io/spring-security/">Spring Security</a> with
|
||||
* Spring Session, and want to ensure security details have been forwarded to the remote process, this is critical.
|
||||
* @return a {@link GatewayFilterSpec} that can be used to apply additional filters
|
||||
*/
|
||||
|
||||
@@ -46,7 +46,7 @@ public class RedirectToGatewayFilterFactoryTests extends BaseWebClientTests {
|
||||
.header("Host", "www.redirectto.org")
|
||||
.exchange()
|
||||
.expectStatus().isEqualTo(HttpStatus.FOUND)
|
||||
.expectHeader().valueEquals(HttpHeaders.LOCATION, "http://example.org");
|
||||
.expectHeader().valueEquals(HttpHeaders.LOCATION, "https://example.org");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -73,11 +73,11 @@ public class RequestHeaderToRequestUriGatewayFilterFactoryIntegrationTests
|
||||
return builder.routes()
|
||||
.route(r -> r.host("**.changeuri.org").and().header("X-Next-Url")
|
||||
.filters(f -> f.requestHeaderToRequestUri("X-Next-Url"))
|
||||
.uri("http://example.com"))
|
||||
.uri("https://example.com"))
|
||||
.route(r -> r.host("**.changeuri.org").and().query("url")
|
||||
.filters(f -> f.changeRequestUri(e -> Optional.of(URI.create(
|
||||
e.getRequest().getQueryParams().getFirst("url")))))
|
||||
.uri("http://example.com"))
|
||||
.uri("https://example.com"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class RequestHeaderToRequestUriGatewayFilterFactoryTests {
|
||||
RequestHeaderToRequestUriGatewayFilterFactory factory = new RequestHeaderToRequestUriGatewayFilterFactory();
|
||||
GatewayFilter filter = factory.apply(c -> c.setName("X-CF-Forwarded-Url"));
|
||||
MockServerHttpRequest request = MockServerHttpRequest.get("http://localhost")
|
||||
.header("X-CF-Forwarded-Url", "http://example.com").build();
|
||||
.header("X-CF-Forwarded-Url", "https://example.com").build();
|
||||
ServerWebExchange exchange = MockServerWebExchange.from(request);
|
||||
exchange.getAttributes().put(GATEWAY_REQUEST_URL_ATTR,
|
||||
URI.create("http://localhost"));
|
||||
@@ -39,7 +39,7 @@ public class RequestHeaderToRequestUriGatewayFilterFactoryTests {
|
||||
ServerWebExchange webExchange = captor.getValue();
|
||||
URI uri = (URI) webExchange.getAttributes().get(GATEWAY_REQUEST_URL_ATTR);
|
||||
assertThat(uri).isNotNull();
|
||||
assertThat(uri.toString()).isEqualTo("http://example.com");
|
||||
assertThat(uri.toString()).isEqualTo("https://example.com");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -140,7 +140,7 @@ public class BetweenRoutePredicateFactoryTests {
|
||||
}
|
||||
|
||||
static ServerWebExchange getExchange() {
|
||||
MockServerHttpRequest request = MockServerHttpRequest.get("http://example.com").build();
|
||||
MockServerHttpRequest request = MockServerHttpRequest.get("https://example.com").build();
|
||||
return MockServerWebExchange.from(request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class CloudFoundryRouteServiceRoutePredicateFactoryIntegrationTests
|
||||
return builder.routes().route(r -> r.cloudFoundryRouteService().and()
|
||||
.header("Host", "dsl.routeservice.example.com")
|
||||
.filters(f -> f.requestHeaderToRequestUri("X-CF-Forwarded-Url"))
|
||||
.uri("http://example.com")).build();
|
||||
.uri("https://example.com")).build();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public class CookieRoutePredicateFactoryTests extends BaseWebClientTests {
|
||||
|
||||
@Test
|
||||
public void noCookiesForYou() {
|
||||
MockServerHttpRequest request = MockServerHttpRequest.get("http://example.com")
|
||||
MockServerHttpRequest request = MockServerHttpRequest.get("https://example.com")
|
||||
.build();
|
||||
MockServerWebExchange exchange = MockServerWebExchange.from(request);
|
||||
|
||||
@@ -46,7 +46,7 @@ public class CookieRoutePredicateFactoryTests extends BaseWebClientTests {
|
||||
|
||||
@Test
|
||||
public void okOneCookieForYou() {
|
||||
MockServerHttpRequest request = MockServerHttpRequest.get("http://example.com")
|
||||
MockServerHttpRequest request = MockServerHttpRequest.get("https://example.com")
|
||||
.cookie(new HttpCookie("yourcookie", "sugar"),
|
||||
new HttpCookie("mycookie", "chip"))
|
||||
.build();
|
||||
|
||||
@@ -37,7 +37,7 @@ public class RouteDefinitionRouteLocatorTests {
|
||||
gatewayProperties.setRoutes(Arrays.asList(new RouteDefinition() {
|
||||
{
|
||||
setId("foo");
|
||||
setUri(URI.create("http://foo.example.com"));
|
||||
setUri(URI.create("https://foo.example.com"));
|
||||
setPredicates(
|
||||
Arrays.asList(new PredicateDefinition("Host=*.example.com")));
|
||||
setFilters(Arrays.asList(
|
||||
|
||||
@@ -32,7 +32,7 @@ public class RouteTests {
|
||||
public void defeaultHttpPort() {
|
||||
Route route = Route.async().id("1")
|
||||
.predicate(exchange -> true)
|
||||
.uri("http://acme.com")
|
||||
.uri("https://acme.com")
|
||||
.build();
|
||||
|
||||
assertThat(route.getUri()).hasHost("acme.com")
|
||||
@@ -56,7 +56,7 @@ public class RouteTests {
|
||||
public void fullUri() {
|
||||
Route route = Route.async().id("1")
|
||||
.predicate(exchange -> true)
|
||||
.uri("http://acme.com:8080")
|
||||
.uri("https://acme.com:8080")
|
||||
.build();
|
||||
|
||||
assertThat(route.getUri()).hasHost("acme.com")
|
||||
|
||||
@@ -85,7 +85,7 @@ class RouteDslTests {
|
||||
@Test
|
||||
fun dslWithFunctionParameters() {
|
||||
val routerLocator = builder.routes {
|
||||
route(id = "test1", order = 10, uri = "http://httpbin.org") {
|
||||
route(id = "test1", order = 10, uri = "https://httpbin.org") {
|
||||
host("**.abc.org")
|
||||
}
|
||||
route(id = "test2", order = 10, uri = "http://someurl") {
|
||||
|
||||
@@ -170,7 +170,7 @@ spring:
|
||||
predicates:
|
||||
- Host=**.redirectto.org
|
||||
filters:
|
||||
- RedirectTo=302, http://example.org
|
||||
- RedirectTo=302, https://example.org
|
||||
|
||||
# =====================================
|
||||
- id: remove_request_header_test
|
||||
|
||||
Reference in New Issue
Block a user