athombv / node-homey-oauth2app

This module does the heavy lifting for a Homey App that talks to any OAuth2 Web API.
https://athombv.github.io/node-homey-oauth2app/
5 stars 5 forks source link

Fix for when an API returns an empty body, but content-type is JSON #51

Closed Christian-Athom closed 3 years ago

WeeJeWel commented 3 years ago

I don't think this is the right place. It means the API is broken, and should be overloaded in the app's OAuth2Client.

Christian-Athom commented 3 years ago

The problem with that is that in the app you cannot know if the response was 20x and the return body was empty, or that the error wan genuine. This is because the .json() call on the respons throws when the body is an empty string.

WeeJeWel commented 3 years ago

Still, you can overload onHandleResponse in your app.

Which API is this, by the way?

Christian-Athom commented 3 years ago

Honeywell Lyric Api

WeeJeWel commented 3 years ago

OK. Please fix it there, I want to to keep this module W3-spec compliant and not introduce hacks.

WeeJeWel commented 3 years ago

FYI They should not return the JSON header, and a 204 status code.