pjfanning commented on code in PR #584:
URL: https://github.com/apache/pekko-http/pull/584#discussion_r1715101867


##########
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:
   before the change to the main source code in this PR, this test actually 
fails - the response is an error response without my main source change



-- 
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]

Reply via email to