XML 喷雾套装 content-type

spray set content-type for XML

尝试发送 xml content-type 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!
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