Ver Fonte

Specify UTF8 for response content

This is needed because in some other platforms, like Windows, the default charset might be different

Issue gh-12026
Marcus Da Coregio há 2 anos atrás
pai
commit
d5aabd721a

+ 1 - 1
saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/Saml2MetadataFilterTests.java

@@ -165,7 +165,7 @@ public class Saml2MetadataFilterTests {
 		this.filter.setMetadataFilename(testMetadataFilename);
 		this.filter.doFilter(this.request, this.response, this.chain);
 		assertThat(this.response.getCharacterEncoding()).isEqualTo(StandardCharsets.UTF_8.name());
-		assertThat(new String(this.response.getContentAsByteArray())).isEqualTo(generatedMetadata);
+		assertThat(this.response.getContentAsString(StandardCharsets.UTF_8)).isEqualTo(generatedMetadata);
 	}
 
 	@Test