Я пытаюсь ударить / потреблять остальные API от scala. Код, который я использую: https://github.com/spray/spray/blob/master/examples/spray-client/simple-spray-client/src/main/scala/spray/examples/Main.scala. Код, который я написал:
path("testapi") { get { import ElevationJsonProtocol._ val pipeline = sendReceive ~> unmarshal[GoogleApiResult[Elevation]] val responseFuture = pipeline { Get("http://maps.googleapis.com/maps/api/elevation/json?locations=27.988056,86.925278&sensor=false") } responseFuture onComplete { case Success(GoogleApiResult(_, Elevation(_, elevation) :: _)) => log.info("The elevation of Mt. Everest is: {} m", elevation) case Success(somethingUnexpected) => log.warning("The Google API call was successful but returned something unexpected: '{}'.", somethingUnexpected) case Failure(error) => log.error(error, "Couldn't get elevation") } } }
Но я получаю сообщение об ошибке:
type mismatch; found : Unit required: spray.routing.ApplyConverter.hac0.In (which expands to) spray.routing.RequestContext => Unit responseFuture onComplete { ^ one error found