Get ahcResponse from Play WS
I had this:
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)
}
The usage was like this:
WS.url("http://stackoverflow.com/questions/ask").failIfNot(OK)
But after upgrading from 2.1 to 2.3, it is achResponse
no longer present. How can I get the basic (and more complete) response object?
+3
source to share