SteelSeries / gamesense-sdk

472 stars 146 forks source link

Incorrect Content-type value for error responses #129

Open Nahor opened 2 years ago

Nahor commented 2 years ago

For invalid requests, e.g. with an invalid game value in a game_event request, GameSense returns a 400 error with a {"error":"..."} string (JSON) in the body but the Content-type is text/html instead of application/json.

This issue is made worse by the fact that for 404 errors (e.g when sending a request to /game_event_foo), GameSense returns a 404 error with a simple Page not found string (i.e. not JSON) in the body.

In other words, an app has no way to know if the response should be parsed or not to extract the error message.