Skip to content

Instantly share code, notes, and snippets.

@takezoe
Created December 9, 2011 02:29
Show Gist options
  • Save takezoe/1449859 to your computer and use it in GitHub Desktop.
Save takezoe/1449859 to your computer and use it in GitHub Desktop.
XML response with Unfiltered
import unfiltered.request._
import unfiltered.response._
import scala.xml._
case class Xml(nodes: NodeSeq)
extends ComposeResponse(TextXmlContent ~> ResponseString(nodes.toString))
// Usage
def intent = {
case GET(Path(Seg("hello" :: name :: Nil))) => {
Ok ~> Xml(<hello>{name}</hello>)
}
}
@takezoe
Copy link
Author

takezoe commented Dec 9, 2011

これだと中でHtmlContentがチェインされているのでContent-Typeがtext/htmlになってしまうのです…。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment