Skip to content

Commit

Permalink
Avoid http URL String (making checkstyleNohttp happy)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller committed Sep 25, 2024
1 parent daa109e commit 49da92b
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ void relativeResourcesAreEqual() throws Exception {
@Test
void unusualRelativeResourcesAreEqual() throws Exception {
Resource resource = new UrlResource("file:dir/");
Resource relative = resource.createRelative("http://spring.io");
assertThat(relative).isEqualTo(new UrlResource("file:dir/http://spring.io"));
Resource relative = resource.createRelative("https://spring.io");
assertThat(relative).isEqualTo(new UrlResource("file:dir/https://spring.io"));
}

@Test
Expand Down Expand Up @@ -422,14 +422,14 @@ void canCustomizeHttpUrlConnectionForRead() throws Exception {
@Test
void useUserInfoToSetBasicAuth() throws Exception {
startServer();
UrlResource resource = new UrlResource("http://alice:secret@localhost:"
+ this.server.getPort() + "/resource");
UrlResource resource = new UrlResource(
"http://alice:secret@localhost:" + this.server.getPort() + "/resource");
assertThat(resource.getInputStream()).hasContent("Spring");
RecordedRequest request = this.server.takeRequest();
String authorization = request.getHeader("Authorization");
assertThat(authorization).isNotNull().startsWith("Basic ");
assertThat(new String(Base64.getDecoder().decode(
authorization.substring(6)), StandardCharsets.ISO_8859_1)).isEqualTo("alice:secret");
assertThat(new String(Base64.getDecoder().decode(authorization.substring(6)),
StandardCharsets.ISO_8859_1)).isEqualTo("alice:secret");
}

@AfterEach
Expand Down

0 comments on commit 49da92b

Please sign in to comment.