When I use
val pipeline: HttpRequest => Future[HttpResponse] = addHeader(.......) ~> sendReceive ~> unmarshal[HttpResponse]
then I can get the Status code as it an object of HttpResponse using
val futureResponse = pipeline(Post(url, body)) futureResponse.map(_.status)
However, when I use a custom unmarshaller as:
val pipeline: HttpRequest => Future[MyResponse] = addHeader(.......) ~> sendReceive ~> unmarshal[MyResponse]
using
val myfutureResponse = pipeline(Post(url, body))
myutureResponse.map(_.status)
doesn't compile as it cannot find status. How do I get the status code here? I need to use a custom unmarshaller to be able to deserialize my json result.
Finally I found an answer based on your suggestion
}
I changed my pipeline method to be
Now that I have got this out of the way, I will learn the API properly