Phoenix API returns html errors instead of messages

Hello,

I have a phoenix application, I noticed that it triggers and return html pages in API responses.

Any ideas how can update that ? return some custom json error response ?

Example image :

Thanks

Hello,

Try to send a request with Accept: application/json header

In development mode, when you hit an error, Phoenix will render a user-friendly page that shows the error and makes it easier to debug. You can switch to the “Preview” tab in Postman to see it.

For production, you should set debug_errors: false. See here.