File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
httpclient/src/test/java/org/baeldung/httpclient/sec Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 2424
2525import java .io .IOException ;
2626import java .nio .charset .Charset ;
27+ import java .nio .charset .StandardCharsets ;
2728
2829import static org .hamcrest .Matchers .equalTo ;
2930import static org .junit .Assert .assertThat ;
@@ -89,7 +90,7 @@ public final void givenAuthorizationHeaderIsSetManually_whenExecutingGetRequest_
8990 public final void givenAuthorizationHeaderIsSetManually_whenExecutingGetRequest_thenSuccess2 () throws IOException {
9091 final HttpGet request = new HttpGet (URL_SECURED_BY_BASIC_AUTHENTICATION );
9192 final String auth = DEFAULT_USER + ":" + DEFAULT_PASS ;
92- final byte [] encodedAuth = Base64 .encodeBase64 (auth .getBytes (Charset . forName ( "ISO-8859-1" ) ));
93+ final byte [] encodedAuth = Base64 .encodeBase64 (auth .getBytes (StandardCharsets . ISO_8859_1 ));
9394 final String authHeader = "Basic " + new String (encodedAuth );
9495 request .setHeader (HttpHeaders .AUTHORIZATION , authHeader );
9596
@@ -129,7 +130,7 @@ private HttpContext context() {
129130
130131 private String authorizationHeader (final String username , final String password ) {
131132 final String auth = username + ":" + password ;
132- final byte [] encodedAuth = Base64 .encodeBase64 (auth .getBytes (Charset . forName ( "ISO-8859-1" ) ));
133+ final byte [] encodedAuth = Base64 .encodeBase64 (auth .getBytes (StandardCharsets . ISO_8859_1 ));
133134
134135 return "Basic " + new String (encodedAuth );
135136 }
You can’t perform that action at this time.
0 commit comments