Remove applyAttributes flag from contribution

See gh-29958
This commit is contained in:
rstoyanchev
2024-03-11 17:36:45 +00:00
parent 052b6357c8
commit 8af1d8e842
21 changed files with 47 additions and 254 deletions

View File

@@ -94,8 +94,6 @@ class DefaultWebTestClientBuilder implements WebTestClient.Builder {
@Nullable
private MultiValueMap<String, String> defaultCookies;
private boolean applyAttributes;
@Nullable
private List<ExchangeFilterFunction> filters;
@@ -157,7 +155,6 @@ class DefaultWebTestClientBuilder implements WebTestClient.Builder {
}
this.defaultCookies = (other.defaultCookies != null ?
new LinkedMultiValueMap<>(other.defaultCookies) : null);
this.applyAttributes = other.applyAttributes;
this.filters = (other.filters != null ? new ArrayList<>(other.filters) : null);
this.entityResultConsumer = other.entityResultConsumer;
this.strategies = other.strategies;
@@ -216,12 +213,6 @@ class DefaultWebTestClientBuilder implements WebTestClient.Builder {
return this.defaultCookies;
}
@Override
public WebTestClient.Builder applyAttributes(boolean applyAttributes) {
this.applyAttributes = applyAttributes;
return this;
}
@Override
public WebTestClient.Builder filter(ExchangeFilterFunction filter) {
Assert.notNull(filter, "ExchangeFilterFunction is required");
@@ -321,25 +312,22 @@ class DefaultWebTestClientBuilder implements WebTestClient.Builder {
this.entityResultConsumer, this.responseTimeout, new DefaultWebTestClientBuilder(this));
}
private ClientHttpConnector initConnector() {
final ClientHttpConnector connector;
private static ClientHttpConnector initConnector() {
if (reactorNettyClientPresent) {
connector = new ReactorClientHttpConnector();
return new ReactorClientHttpConnector();
}
else if (reactorNetty2ClientPresent) {
return new ReactorNetty2ClientHttpConnector();
}
else if (jettyClientPresent) {
connector = new JettyClientHttpConnector();
return new JettyClientHttpConnector();
}
else if (httpComponentsClientPresent) {
connector = new HttpComponentsClientHttpConnector();
return new HttpComponentsClientHttpConnector();
}
else {
connector = new JdkClientHttpConnector();
return new JdkClientHttpConnector();
}
connector.setApplyAttributes(this.applyAttributes);
return connector;
}
private ExchangeStrategies initExchangeStrategies() {

View File

@@ -64,8 +64,6 @@ public class HttpHandlerConnector implements ClientHttpConnector {
private final HttpHandler handler;
private boolean applyAttributes = true;
/**
* Constructor with the {@link HttpHandler} to handle requests with.
@@ -84,16 +82,6 @@ public class HttpHandlerConnector implements ClientHttpConnector {
.subscribeOn(Schedulers.parallel());
}
@Override
public void setApplyAttributes(boolean applyAttributes) {
this.applyAttributes = applyAttributes;
}
@Override
public boolean getApplyAttributes() {
return this.applyAttributes;
}
private Mono<ClientHttpResponse> doConnect(
HttpMethod httpMethod, URI uri, Function<? super ClientHttpRequest, Mono<Void>> requestCallback) {

View File

@@ -425,13 +425,6 @@ public interface WebTestClient {
*/
Builder defaultCookies(Consumer<MultiValueMap<String, String>> cookiesConsumer);
/**
* Global option to specify whether or not attributes should be applied to every request,
* if the used {@link ClientHttpConnector} allows it.
* @param applyAttributes whether or not to apply attributes
*/
Builder applyAttributes(boolean applyAttributes);
/**
* Add the given filter to the filter chain.
* @param filter the filter to be added to the chain

View File

@@ -55,8 +55,6 @@ class WiretapConnector implements ClientHttpConnector {
private final Map<String, ClientExchangeInfo> exchanges = new ConcurrentHashMap<>();
private boolean applyAttributes = true;
WiretapConnector(ClientHttpConnector delegate) {
this.delegate = delegate;
@@ -86,16 +84,6 @@ class WiretapConnector implements ClientHttpConnector {
});
}
@Override
public void setApplyAttributes(boolean applyAttributes) {
this.applyAttributes = applyAttributes;
}
@Override
public boolean getApplyAttributes() {
return this.applyAttributes;
}
/**
* Create the {@link ExchangeResult} for the given "request-id" header value.
*/

View File

@@ -86,8 +86,6 @@ public class MockMvcHttpConnector implements ClientHttpConnector {
private final List<RequestPostProcessor> requestPostProcessors;
private boolean applyAttributes = true;
public MockMvcHttpConnector(MockMvc mockMvc) {
this(mockMvc, Collections.emptyList());
@@ -117,16 +115,6 @@ public class MockMvcHttpConnector implements ClientHttpConnector {
}
}
@Override
public void setApplyAttributes(boolean applyAttributes) {
this.applyAttributes = applyAttributes;
}
@Override
public boolean getApplyAttributes() {
return this.applyAttributes;
}
private RequestBuilder adaptRequest(
HttpMethod httpMethod, URI uri, Function<? super ClientHttpRequest, Mono<Void>> requestCallback) {