In my Play-Scala application, I need to register failed requests from clients. To do this, I redid GlobalSettings.onBadRequestas follows:
override def onBadRequest(request: RequestHeader, error: String) = {
L.warn(s"Bad request: $request! Error: $error")
Future.successful(Results.BadRequest)
}
However, I cannot access the body of the request (i.e., an invalid JSON string) inside this hook method. Is there a way to get and register a body string in case of a bad request?
Please note that I am using Play Framework 2.3 with Scala 2.11.
source
share