Merge branch '6.0.x'

This commit is contained in:
Sam Brannen
2023-06-22 15:12:25 +02:00
14 changed files with 27 additions and 30 deletions

View File

@@ -738,7 +738,7 @@ class DefaultWebClient implements WebClient {
private final ClientRequestObservationContext observationContext;
public ObservationFilterFunction(ClientRequestObservationContext observationContext) {
ObservationFilterFunction(ClientRequestObservationContext observationContext) {
this.observationContext = observationContext;
}

View File

@@ -121,14 +121,14 @@ class DefaultServerResponseBuilder implements ServerResponse.BodyBuilder {
@Override
public ServerResponse.BodyBuilder allow(HttpMethod... allowedMethods) {
Assert.notNull(allowedMethods, "Http allowedMethod must not be null");
Assert.notNull(allowedMethods, "Http allowedMethods must not be null");
this.headers.setAllow(new LinkedHashSet<>(Arrays.asList(allowedMethods)));
return this;
}
@Override
public ServerResponse.BodyBuilder allow(Set<HttpMethod> allowedMethods) {
Assert.notNull(allowedMethods, "Http allowedMethod must not be null");
Assert.notNull(allowedMethods, "Http allowedMethods must not be null");
this.headers.setAllow(allowedMethods);
return this;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,12 +60,12 @@ public class ParameterContentTypeResolverTests {
Map<String, MediaType> mapping = Collections.emptyMap();
RequestedContentTypeResolver resolver = new ParameterContentTypeResolver(mapping);
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
assertThat(mediaTypes).isEqualTo(Collections.singletonList(new MediaType("text", "html")));
assertThat(mediaTypes).containsExactly(new MediaType("text", "html"));
mapping = Collections.singletonMap("HTML", MediaType.APPLICATION_XHTML_XML);
resolver = new ParameterContentTypeResolver(mapping);
mediaTypes = resolver.resolveMediaTypes(exchange);
assertThat(mediaTypes).isEqualTo(Collections.singletonList(new MediaType("application", "xhtml+xml")));
assertThat(mediaTypes).containsExactly(new MediaType("application", "xhtml+xml"));
}
@Test
@@ -74,7 +74,7 @@ public class ParameterContentTypeResolverTests {
RequestedContentTypeResolver resolver = new ParameterContentTypeResolver(Collections.emptyMap());
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
assertThat(mediaTypes).isEqualTo(Collections.singletonList(new MediaType("application", "vnd.ms-excel")));
assertThat(mediaTypes).containsExactly(new MediaType("application", "vnd.ms-excel"));
}
@Test // SPR-13747
@@ -84,7 +84,7 @@ public class ParameterContentTypeResolverTests {
ParameterContentTypeResolver resolver = new ParameterContentTypeResolver(mapping);
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
assertThat(mediaTypes).isEqualTo(Collections.singletonList(MediaType.APPLICATION_JSON));
assertThat(mediaTypes).containsExactly(MediaType.APPLICATION_JSON);
}
private MockServerWebExchange createExchange(String format) {

View File

@@ -40,7 +40,7 @@ public class RequestedContentTypeResolverBuilderTests {
MockServerHttpRequest.get("/flower").accept(MediaType.IMAGE_GIF));
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
assertThat(mediaTypes).isEqualTo(Collections.singletonList(MediaType.IMAGE_GIF));
assertThat(mediaTypes).containsExactly(MediaType.IMAGE_GIF);
}
@Test
@@ -52,7 +52,7 @@ public class RequestedContentTypeResolverBuilderTests {
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/flower?format=json"));
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
assertThat(mediaTypes).isEqualTo(Collections.singletonList(MediaType.APPLICATION_JSON));
assertThat(mediaTypes).containsExactly(MediaType.APPLICATION_JSON);
}
@Test
@@ -87,11 +87,11 @@ public class RequestedContentTypeResolverBuilderTests {
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/"));
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
assertThat(mediaTypes).isEqualTo(Collections.singletonList(MediaType.APPLICATION_JSON));
assertThat(mediaTypes).containsExactly(MediaType.APPLICATION_JSON);
exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/").accept(MediaType.ALL));
mediaTypes = resolver.resolveMediaTypes(exchange);
assertThat(mediaTypes).isEqualTo(Collections.singletonList(MediaType.APPLICATION_JSON));
assertThat(mediaTypes).containsExactly(MediaType.APPLICATION_JSON);
}
@Test
@@ -104,7 +104,7 @@ public class RequestedContentTypeResolverBuilderTests {
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/")
.accept(MediaType.valueOf("*/*;q=0.8")));
List<MediaType> mediaTypes = resolver.resolveMediaTypes(exchange);
assertThat(mediaTypes).isEqualTo(Collections.singletonList(MediaType.APPLICATION_JSON));
assertThat(mediaTypes).containsExactly(MediaType.APPLICATION_JSON);
}
}