pjfanning commented on code in PR #584:
URL: https://github.com/apache/pekko-http/pull/584#discussion_r1738586441
##########
http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/MarshallingDirectivesSpec.scala:
##########
@@ -275,4 +275,23 @@ class MarshallingDirectivesSpec extends RoutingSpec with
Inside {
}
}
}
+
+ "The marshalling infrastructure for text" should {
+ val foo = "Hällö"
+ "render text with UTF-8 encoding if no `Accept-Charset` request header is
present" in {
+ Get() ~> complete(foo) ~> check {
+ responseEntity shouldEqual HttpEntity(ContentType(`text/plain`,
`UTF-8`), foo)
+ }
+ }
+ "render text with requested encoding if an `Accept-Charset` request header
requests a non-UTF-8 encoding" in {
+ Get() ~> `Accept-Charset`(`ISO-8859-1`) ~> complete(foo) ~> check {
+ responseEntity shouldEqual HttpEntity(ContentType(`text/plain`,
`ISO-8859-1`), foo)
+ }
+ }
+ "render text with UTF-8 encoding if an `Accept-Charset` request header
requests an unknown encoding" in {
+ Get() ~> `Accept-Charset`(HttpCharset("unknown")(Nil)) ~> complete(foo)
~> check {
+ responseEntity shouldEqual HttpEntity(ContentType(`text/plain`,
`UTF-8`), foo)
+ }
+ }
Review Comment:
@raboof would you be able to take a look at this again? I don't think this
change breaks anything and makes the pekko-http support for `Accept-Charset` a
bit more tolerant.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]