Just what the title says basically. it should be very doable to make the debug mechanism from debug_errors: true detect the content type to determine its response. as it is responding with html when testing json apis, while debug errors is enabled on the endpoint, isnt very helpful.