【发布时间】:2021-03-29 16:16:59
【问题描述】:
给定如下路线:
get {
complete(HttpEntity(ContentTypes.`application/json`, source))
//say source is Source[ByteString, _] from the Http response of a third party API
}
如何将来自第 3 方 API 的响应状态代码映射(覆盖)到上述完整信息中。我知道使用 complete(Future(HttpResponse)) 可以做到这一点,但是我们如何使用 Source 来实现呢?
有没有办法使用 mapResponse 或 mapResponseEntity 来实现这一点?
【问题讨论】:
标签: scala akka akka-stream akka-http