Removed the use of Accept-Charset when using the HAPI client (#5961)

* Removed the use of Accept-Charset when using the HAPI client

* Added changelog

* Update 5962-remove-use-of-deprecated-accept-charset-header.yaml
This commit is contained in:
Jens Kristian Villadsen 2024-05-24 19:35:57 +02:00 committed by GitHub
parent 93e101973e
commit 848fee05c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 7 deletions

View File

@ -136,7 +136,6 @@ public class OkHttpRestfulClient implements IHttpClient {
} }
addUserAgentHeader(theHttpRequest, theContext); addUserAgentHeader(theHttpRequest, theContext);
addAcceptCharsetHeader(theHttpRequest);
MethodUtil.addAcceptHeaderToRequest(theEncoding, theHttpRequest, theContext); MethodUtil.addAcceptHeaderToRequest(theEncoding, theHttpRequest, theContext);
addIfNoneExistHeader(theHttpRequest); addIfNoneExistHeader(theHttpRequest);
} }
@ -145,10 +144,6 @@ public class OkHttpRestfulClient implements IHttpClient {
theHttpRequest.addHeader("User-Agent", HttpClientUtil.createUserAgentString(theContext, "okhttp")); theHttpRequest.addHeader("User-Agent", HttpClientUtil.createUserAgentString(theContext, "okhttp"));
} }
private void addAcceptCharsetHeader(OkHttpRestfulRequest theHttpRequest) {
theHttpRequest.addHeader("Accept-Charset", "utf-8");
}
private void addIfNoneExistHeader(IHttpRequest result) { private void addIfNoneExistHeader(IHttpRequest result) {
if (myIfNoneExistParams != null) { if (myIfNoneExistParams != null) {
addIfNoneExistHeaderFromParams(result, myIfNoneExistParams); addIfNoneExistHeaderFromParams(result, myIfNoneExistParams);

View File

@ -81,7 +81,6 @@ public abstract class BaseHttpClient implements IHttpClient {
} }
theHttpRequest.addHeader("User-Agent", HttpClientUtil.createUserAgentString(theContext, "apache")); theHttpRequest.addHeader("User-Agent", HttpClientUtil.createUserAgentString(theContext, "apache"));
theHttpRequest.addHeader("Accept-Charset", "utf-8");
theHttpRequest.addHeader("Accept-Encoding", "gzip"); theHttpRequest.addHeader("Accept-Encoding", "gzip");
addHeaderIfNoneExist(theHttpRequest); addHeaderIfNoneExist(theHttpRequest);

View File

@ -0,0 +1,4 @@
---
type: fix
issue: 5962
title: "The default use of the Accept-Charset header has been removed as its use is deprecated. Thanks to Jens Villadsen for the suggestion and pull request!"

View File

@ -119,7 +119,6 @@ public class JaxRsHttpClient implements IHttpClient {
} }
theHttpRequest.addHeader("User-Agent", HttpClientUtil.createUserAgentString(theContext, "jax-rs")); theHttpRequest.addHeader("User-Agent", HttpClientUtil.createUserAgentString(theContext, "jax-rs"));
theHttpRequest.addHeader("Accept-Charset", "utf-8");
Builder request = theHttpRequest.getRequest(); Builder request = theHttpRequest.getRequest();
request.acceptEncoding("gzip"); request.acceptEncoding("gzip");