Closed jghaanstra closed 10 months ago
For now I'm overwriting onHandleResponse()
and changed the block from line https://github.com/athombv/node-homey-oauth2app/blob/3afb45d51c5b7f23873cb735cd22147bca73be20/lib/OAuth2Client.js#L847
if (typeof contentType === 'string') {
if (contentType.startsWith('application/json')) {
body = await response.json();
} else if (contentType.startsWith('image')) {
body = response;
} else {
body = await response.text();
}
} else {
body = await response.text();
}
I believe this is such a rare occurrence, that it's fine to overload the methods (that's what they're for!), and not implement this in the module itself.
Okay, I implemented it after all :-)
Thank you!
https://github.com/athombv/node-homey-oauth2app/commit/3d7a200f02816cf1e5af4b6071e0239de5947ad7
Thanx!
The current implementation only allows to retrieve JSON data. Some devices might require the retrieval of images like motion snapshots. There currently isnt a (easy) way to do this using this module.