An open API service indexing awesome lists of open source software.

https://github.com/guizmaii/playscala-compiletimedi-jsonhttperrorhandler

Play Scala (with compile time DI) JsonHttpErrorHandler example project
https://github.com/guizmaii/playscala-compiletimedi-jsonhttperrorhandler

compile-time dependency-injection json playframework rest-api scala

Last synced: about 2 months ago
JSON representation

Play Scala (with compile time DI) JsonHttpErrorHandler example project

Awesome Lists containing this project

README

          

# PlayScala-CompileTimeDI-JsonHttpErrorHandler

Play Scala (with compile time DI) `JsonHttpErrorHandler` example project.

## Instructions to test the new `JsonHttpErrorHandler`

1. Publish a local version of Play
1.1 `$ git clone https://github.com/guizmaii/playframework`
1.2 `$ cd playframework`
1.3 `$ git checkout json_default_http_error_handler`
1.4 `$ sbt clean publishLocal`

2. (If necessary) Change the version of Play in `project/plugins.sbt` with the previously locally published one.

3. `$ sbt run`

4. Test with diffent calls
4.1 (HTTP 200) `$ curl -v http://localhost:9000/ | python -m json.tool`
4.2 (HTTP 404) `$ curl -v http://localhost:9000/routeThatDoesNotExist | python -m json.tool`
4.3 (HTTP 500) `$ curl -v http://localhost:9000/exception | python -m json.tool`

(The `| python -m json.tool` part of the command is here to pretty print JSON answers. Comes from here: https://stackoverflow.com/a/1920585)