I am calling a webservice like this:
WS
.url(url)
.get
.map { response => // error occurs on this line
response.status match {
case 200 => Right(response.json)
case status => Left(s"Problem accessing api, status '$status'")
}
}
The complete error: Error: Cannot find an implicit ExecutionContext, either require one yourself or import ExecutionContext.Implicits.global
According to this issue, it is fixed in the documentation. I needed to add the following import:
Since Play 2.4 you can inject default
execution context
via Guice dependency: injection.An alternative option: