Skip to content

Commit 61bc009

Browse files
authored
fix Twirl example to correctly render in a browser (#189)
## Issue When I tried the Twirl example in my browser, I noticed the HTML wasn't rendering. This is due to the `Content-Type` header coming back as `text/plain` instead of ` text/html` ## Change I build a full cask.Response object so I can set the content-type header. Ideally there is a better way to set this up. As I'm only just poking at the framework I'm not sure what the best way is, but I'm submitting what worked for me.
1 parent 27dfe9a commit 61bc009

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

example/twirl/app/src/Twirl.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ package app
22
object Twirl extends cask.MainRoutes{
33
@cask.get("/")
44
def hello() = {
5-
"<!doctype html>" + html.hello("Hello World")
5+
val payload = "<!doctype html>" + html.hello("Hello World")
6+
cask.Response(payload, 200, Seq(("Content-Type", "text/html")) )
67
}
78

89
initialize()

0 commit comments

Comments
 (0)