When you throw an exception in Symfony - even an HttpException - it returns an HTML
page. Notice the Content-Type header here of text/html. And in reality, this is returning
a full, giant HTML exception page - my test helpers are just summarizing things.
Why is that? Why does Symfony default to the idea that if something goes wrong, it
should return HTML?
Here's the answer: for every single request, Symfony has what's called a "request format",
and it defaults to html. But there are a number of different ways to say "Hey Symfony,
the user wants json, so if something goes wrong, give them that".
The easiest way to set the request format is in your routing. Open up app/config/routing.yml: