Spray - Complete with HTTP code based on Left-Right in Either

Viewed 492

I have a construct like the following

    handleWith {
               mr: MyRequest =>
                (myactor ? mr).mapTo[Either[BadRequest, GoodResponse]]

             }

Based on the result of the Either, I would like to complete with either a 200 based on the Right response and some sort of 4XX based on the left. I'm not quite sure how to pull the future into a Match, in order to do this though.

1 Answers
Related