I have an endpoint we can call /test
that internally fetches data from a 3rd party API and then wants to do some transformation before returning a response. Where I am hung up is this 3rd party API is returning gzipped JSON and I can't decode it (yet). I found the decodeRequest directive but it seems I have to use this in my routing and I am a level deeper here. I have an internal method I call once I receive a GET
to my endpoint /test
which is named do3rdPartyAPIRequest
where I build up an HttpRequest
and pass to Http().singleRequest()
so then in return I have a Future[HttpResponse]
which is where I think I want to be but I am stuck here.
With some local APIs I built and consumed in a similar fashion I didn't encode my responses so typically with a Future[HttpResponse]
I check the response status and go into conversion to JSON via Unmarshal
but this one needs an extra step as far as I know before transforming to JSON. I realize this question is very similar to this one however that is spray specific and I haven't been able to translate this answer into current akka http