Tidy up code

***NO_CI***
This commit is contained in:
dotasek 2024-10-25 17:01:09 -04:00
parent 0308d18107
commit f82f8764cf
2 changed files with 2 additions and 4 deletions

View File

@ -22,8 +22,7 @@ public class ManagedWebAccessBuilder extends ManagedWebAccessBuilderBase<Managed
}
private Map<String, String> newHeaders() {
Map<String, String> headers = new HashMap<String, String>();
headers.putAll(this.getHeaders());
Map<String, String> headers = new HashMap<String, String>(this.getHeaders());
if (getAuthenticationMode() == HTTPAuthenticationMode.TOKEN) {
headers.put("Authorization", "Bearer " + getToken());
} else if (getAuthenticationMode() == HTTPAuthenticationMode.BASIC) {
@ -35,7 +34,6 @@ public class ManagedWebAccessBuilder extends ManagedWebAccessBuilderBase<Managed
if (getUserAgent() != null) {
headers.put("User-Agent", getUserAgent());
}
return headers;
}

View File

@ -109,7 +109,7 @@ public class SimpleHTTPClient {
private void setAuthenticationHeader(HttpURLConnection c) {
String authHeaderValue = null;
if (authenticationMode == HTTPAuthenticationMode.TOKEN) {
authHeaderValue = "Bearer " + new String(token);
authHeaderValue = "Bearer " + token;
} else if (authenticationMode == HTTPAuthenticationMode.BASIC) {
String auth = username+":"+password;
byte[] encodedAuth = Base64.getEncoder().encode(auth.getBytes(StandardCharsets.UTF_8));