尝试发送xml内容类型的Mime-header
时sender ! HttpResponse(status = 200, entity = responseBody, headers = List(`Content-Type`(`text/xml`)))
我收到错误:
not found: value text/xml
我尝试使用application / xml也无效,application / json正在使用FWIW
是否缺少某些导入?
编辑:尝试添加此
import spray.http.MediaTypes._
sender ! HttpResponse(status = 400, entity = responseBody, headers = List(`Content-Type`(`application/xml`)))
这给出了以下错误:
Explicitly set response header 'Content-Type: application/xml' is
ignored, the response Content-Type is set via the response's HttpEntity!
答案 0 :(得分:0)
import spray.http.HttpEntity
sender ! HttpResponse(status = 200, entity = httpEntity(`application/xml`,responseBody))
相关文件
http://spray.io/documentation/1.2.2/spray-http/#content-type-header