I am trying to set application/json as content-Type in a spray-routing actor. But the content-type i see in my response always is text/plain. I tried using the spray-routing approach ("something") and the spray-can approacch ("something2") but the two routes don't send the response-type properly. Did I miss something?
def receive = runRoute {
path("something") {
get {
respondWithHeader(`Content-Type`(`application/json`)) {
complete("""{ "key": "value" }""")
}
}
} ~
path("something2") {
get {
complete(HttpResponse(entity = """{ "key": "value" }""").withHeaders((List(`Content-Type`(`application/json`)))))
}
}
}`enter code here`