我有这个:
class RichResponse(future: Future[WSResponse]) {
def failIfNot(statuses: Int*)(implicit executor: ExecutionContext) = {
future.map { response =>
if(statuses.contains(response.status)) {
response
} else {
throw new RuntimeException("Bad HTTP response for %s: %s".format(
response.ahcResponse.getUri, response.status))
}
}
}
}
object Implicits {
implicit def responseToRichResponse(future: Future[WSResponse]) = new RichResponse(future)
}
用法是这样的:
WS.url("http://stackoverflow.com/questions/ask").failIfNot(OK)
但是从2.1升级到2.3后,achResponse
就不再存在了。如何获得底层(更完整的)响应对象?