Is any version of Scalatra capable of serving images with the correct Content-Type
header? I can't seem to suppress the automatic addition of charset
.
Example of returning a File
:
class MyServlet extends org.scalatra.ScalatraServlet {
get("/") {
contentType = "image/png"
new java.io.File("/tmp/test.png")
}
}
$ curl --head localhost:8080
HTTP/1.1 200 OK
Date: Thu, 01 Aug 2019 21:43:28 GMT
Content-Type: image/png;charset=utf-8
Transfer-Encoding: chunked
Server: Jetty(9.4.8.v20171121)
Example of returning an InputStream
:
class MyServlet extends org.scalatra.ScalatraServlet {
get("/") {
contentType = "image/png"
new java.io.FileInputStream(new java.io.File("/tmp/test.png"))
}
}
$ curl --head localhost:8080
HTTP/1.1 200 OK
Date: Thu, 01 Aug 2019 21:49:52 GMT
Content-Type: image/png;charset=utf-8
Content-Length: 2881
Server: Jetty(9.4.8.v20171121)