Skip to content

Commit f1ad6ef

Browse files
authored
Merge pull request #408 from AVSystem/jetty-charset
Set content type and character encoding in JettyRPCFramework response
2 parents 456a54a + 481f7b2 commit f1ad6ef

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

commons-jetty/src/main/scala/com/avsystem/commons/jetty/rpc/JettyRPCFramework.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ object JettyRPCFramework extends StandardRPCFramework with LazyLogging {
104104
val async = request.startAsync().setup(_.setTimeout(contextTimeout.toMillis))
105105
handlePost(call).andThenNow {
106106
case Success(responseContent) =>
107+
response.setContentType(MimeTypes.Type.APPLICATION_JSON.asString())
108+
response.setCharacterEncoding(StandardCharsets.UTF_8.name())
107109
response.getWriter.write(responseContent.s)
108110
case Failure(t) =>
109111
response.sendError(HttpStatus.INTERNAL_SERVER_ERROR_500, t.getMessage)

commons-jetty/src/test/scala/com/avsystem/commons/jetty/rpc/JettyRPCFrameworkTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class JettyRPCFrameworkTest extends AnyFunSuite with ScalaFutures with Matchers
9393
}
9494

9595
test("inner rpc + string arg -> string") {
96-
val world = "world"
96+
val world = "gżegżółka"
9797
rpc.topper.hello(world).futureValue shouldBe world
9898
val anonymous = ""
9999
rpc.topper.hello(anonymous).futureValue shouldBe anonymous

0 commit comments

Comments
 (0)