Prefer config supplied content-type and accept header.

Original Pull Request #2328
Closes #2327
This commit is contained in:
Peter-Josef Meisch 2022-10-08 15:10:26 +02:00 committed by GitHub
parent 8bb3474c05
commit 02b6d54cc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -256,6 +256,15 @@ public interface WebClientProvider {
HttpHeaders suppliedHeaders = clientConfiguration.getHeadersSupplier().get();
if (suppliedHeaders != null && suppliedHeaders != HttpHeaders.EMPTY) {
// remove content-type and accept if they are provided by the client configuration (ES7 compatibility headers)
if (suppliedHeaders.containsKey(HttpHeaders.CONTENT_TYPE)) {
httpHeaders.remove(HttpHeaders.CONTENT_TYPE);
}
if (suppliedHeaders.containsKey(HttpHeaders.ACCEPT)) {
httpHeaders.remove(HttpHeaders.ACCEPT);
}
httpHeaders.addAll(suppliedHeaders);
}
}));