Just a reminder for self -type of gist, and overly verbose on purpose.
{
"statusCode": 400,
"error": "Bad Request",
"message": "body should be object"
}
With payload { "lol": "kissa" }
, returns
{
"statusCode": 400,
"error": "Bad Request",
"message": "body should have required property 'email'"
}
and with payload { "email": "kaunis kissa" }
returns
{
"statusCode": 400,
"error": "Bad Request",
"message": "body.email should match format \"email\""
}
Eg. ?test=2
in query string returns
{
"statusCode": 400,
"error": "Bad Request",
"message": "querystring.test should be >= 200"
}
Typings prevent returning invalid responses, but had we managed to return { "nok": true }
the response to the caller would be
{
"statusCode": 500,
"error": "Internal Server Error",
"message": "\"ok\" is required!"
}