I want to create a route that matches only if the client sends a specific Accept
header. I use Spray 1.2-20130822.
I'd like to get the route working:
def receive = runRoute {
get {
path("") {
accept("application/json") {
complete(...)
}
}
}
}
Here I found a spec using an accept()
function, but I can't figure out what to import in my Spray-Handler to make it work as directive. Also, I did not find other doc on header directives but these stubs.
${mr: _*}
fails if more than oneMediaRange
are passed in and none of them are matched. If I change that to${mr}
it runs, though the output contains the type ofmr
now which probably is not intended. – Garnish