-
-
Save tomatophobia/981c3d434f9e793b57465966644dbdca 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
| type HttpApp = Request => Future[Response] | |
| val app: HttpApp = { | |
| case Request(POST, Uri("/translate"), text) => | |
| Translator.future(text).map(Response(OK, _)) | |
| case _ => | |
| Future.successful(Response(NotFound)) | |
| } | |
| // Unit test | |
| val req = Request(POST, Uri("/translate"), "one") | |
| // req: Request = Request(POST,Uri(/translate),one) | |
| asyncAssert("uno", app(req).map(_.body)) | |
| // ✔ uno |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment