当我尝试获取这样的亚马逊身份数据时
val pipeline: HttpRequest => Future[IdentityData] = sendReceive ~> unmarshal[IdentityData]
pipeline(Get("http://169.254.169.254/latest/dynamic/instance-identity/document"))
使用适当的案例类和格式化程序,我收到以下异常
不支持的内容类型(预期的“应用程序/json”)
因为亚马逊将他们的回复标记为文本/纯内容类型。他们也不关心Accept标头参数。有没有一种简单的方法可以告诉 spray-json 在解组时忽略这一点?