Only response JSON when header "Accept: application/json" is set into request

##### Run app.

    python test_app.py

##### Urls to try.

http://localhost:8080/
http://localhost:8080/error
http://localhost:8080/failure

##### Into browser try urls.

Responses looks like a normal response without json format over debug template when raise errors.
This is useful when you use debug middleware like werkzeug.

##### Into Postman chrome extension set header "Accept: application/json" and try urls.

Responses has JSON format for API.