Created
May 21, 2018 09:20
-
-
Save robhinds/e56c5daa8a3c00efb0df54bda7661eb1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait DefaultResponseSerializerComponent extends ResponseSerializerComponent { | |
override def responseSerializer: ResponseSerializer = new ResponseSerializer { | |
override def serialiseResponse[B: Encoder](e: Either[ErrorResponse, B]): Json = e match { | |
case Left(x) => x.asJson | |
case Right(x) => | |
Json.fromFields(List( | |
("status", Json.fromString("200")), | |
("data", x.asJson) | |
)) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment