Use HTTPS for external links wherever possible

See gh-16320
This commit is contained in:
Spring Operator
2019-03-26 04:16:22 -05:00
committed by Andy Wilkinson
parent 864942ad4f
commit 9fc3ac7d49
12 changed files with 48 additions and 48 deletions

View File

@@ -53,9 +53,9 @@ public class DefaultWebClientExchangeTagsProviderTests {
public void setup() {
this.request = ClientRequest
.create(HttpMethod.GET,
URI.create("http://example.org/projects/spring-boot"))
URI.create("https://example.org/projects/spring-boot"))
.attribute(URI_TEMPLATE_ATTRIBUTE,
"http://example.org/projects/{project}")
"https://example.org/projects/{project}")
.build();
this.response = mock(ClientResponse.class);
given(this.response.statusCode()).willReturn(HttpStatus.OK);
@@ -72,7 +72,7 @@ public class DefaultWebClientExchangeTagsProviderTests {
@Test
public void tagsWhenNoUriTemplateShouldProvideUriPath() {
ClientRequest request = ClientRequest.create(HttpMethod.GET,
URI.create("http://example.org/projects/spring-boot")).build();
URI.create("https://example.org/projects/spring-boot")).build();
Iterable<Tag> tags = this.tagsProvider.tags(request, this.response, null);
assertThat(tags).containsExactlyInAnyOrder(Tag.of("method", "GET"),
Tag.of("uri", "/projects/spring-boot"),

View File

@@ -71,7 +71,7 @@ public class MetricsWebClientFilterFunctionTests {
@Test
public void filterShouldRecordTimer() {
ClientRequest request = ClientRequest.create(HttpMethod.GET,
URI.create("http://example.com/projects/spring-boot")).build();
URI.create("https://example.com/projects/spring-boot")).build();
given(this.response.statusCode()).willReturn(HttpStatus.OK);
this.filterFunction.filter(request, this.exchange).block(Duration.ofSeconds(30));
assertThat(this.registry.get("http.client.requests")
@@ -83,7 +83,7 @@ public class MetricsWebClientFilterFunctionTests {
public void filterWhenUriTemplatePresentShouldRecordTimer() {
ClientRequest request = ClientRequest
.create(HttpMethod.GET,
URI.create("http://example.com/projects/spring-boot"))
URI.create("https://example.com/projects/spring-boot"))
.attribute(URI_TEMPLATE_ATTRIBUTE, "/projects/{project}").build();
given(this.response.statusCode()).willReturn(HttpStatus.OK);
this.filterFunction.filter(request, this.exchange).block(Duration.ofSeconds(30));
@@ -95,7 +95,7 @@ public class MetricsWebClientFilterFunctionTests {
@Test
public void filterWhenIoExceptionThrownShouldRecordTimer() {
ClientRequest request = ClientRequest.create(HttpMethod.GET,
URI.create("http://example.com/projects/spring-boot")).build();
URI.create("https://example.com/projects/spring-boot")).build();
ExchangeFunction errorExchange = (r) -> Mono.error(new IOException());
this.filterFunction.filter(request, errorExchange)
.onErrorResume(IOException.class, (t) -> Mono.empty())
@@ -110,7 +110,7 @@ public class MetricsWebClientFilterFunctionTests {
@Test
public void filterWhenExceptionThrownShouldRecordTimer() {
ClientRequest request = ClientRequest.create(HttpMethod.GET,
URI.create("http://example.com/projects/spring-boot")).build();
URI.create("https://example.com/projects/spring-boot")).build();
ExchangeFunction exchange = (r) -> Mono.error(new IllegalArgumentException());
this.filterFunction.filter(request, exchange)
.onErrorResume(IllegalArgumentException.class, (t) -> Mono.empty())
@@ -124,7 +124,7 @@ public class MetricsWebClientFilterFunctionTests {
@Test
public void filterWhenExceptionAndRetryShouldNotCumulateRecordTime() {
ClientRequest request = ClientRequest.create(HttpMethod.GET,
URI.create("http://example.com/projects/spring-boot")).build();
URI.create("https://example.com/projects/spring-boot")).build();
ExchangeFunction exchange = (r) -> Mono.error(new IllegalArgumentException())
.delaySubscription(Duration.ofMillis(300)).cast(ClientResponse.class);
this.filterFunction.filter(request, exchange).retry(1)

View File

@@ -51,9 +51,9 @@ public class WebClientExchangeTagsTests {
public void setup() {
this.request = ClientRequest
.create(HttpMethod.GET,
URI.create("http://example.org/projects/spring-boot"))
URI.create("https://example.org/projects/spring-boot"))
.attribute(URI_TEMPLATE_ATTRIBUTE,
"http://example.org/projects/{project}")
"https://example.org/projects/{project}")
.build();
this.response = mock(ClientResponse.class);
given(this.response.statusCode()).willReturn(HttpStatus.OK);
@@ -75,7 +75,7 @@ public class WebClientExchangeTagsTests {
public void uriWhenRelativeTemplateIsAvailableShouldReturnTemplate() {
this.request = ClientRequest
.create(HttpMethod.GET,
URI.create("http://example.org/projects/spring-boot"))
URI.create("https://example.org/projects/spring-boot"))
.attribute(URI_TEMPLATE_ATTRIBUTE, "/projects/{project}").build();
assertThat(WebClientExchangeTags.uri(this.request))
.isEqualTo(Tag.of("uri", "/projects/{project}"));
@@ -84,7 +84,7 @@ public class WebClientExchangeTagsTests {
@Test
public void uriWhenTemplateIsMissingShouldReturnPath() {
this.request = ClientRequest.create(HttpMethod.GET,
URI.create("http://example.org/projects/spring-boot")).build();
URI.create("https://example.org/projects/spring-boot")).build();
assertThat(WebClientExchangeTags.uri(this.request))
.isEqualTo(Tag.of("uri", "/projects/spring-boot"));
}