HTML response with 502 error from API end-point

Yes the expected response from the API is JSON, but there is no guarantee that it’ll be the case all the time as there may be unexpected errors.

Because it’s not guaranteed to be JSON 100% of the time you as a 3rd party dev should design your app to be able to gracefully handle unexpected responses, such as HTML.

This is a discussion forum, as has been previously mentioned if you want to request a feature you should go through the proper process which is submitting it to uservoice.

Even if twitch was to make changes for the specific error you encountered it doesn’t mean that there may not be an error that for some reason results in a non-JSON reaponse, so don’t neglect proper error handling and best design practices by expecting Twitch, or any API, to conform to your specific apps lack of error handling. Continuing to argue with other 3rd party devs here on the forum won’t fix your code, or make changes to Twitchs API.