When trying to run the tests after updating dependencies, I discovered that Chargify's API is kind of broken. For example, when one doesn't have valid API token, Chargify return a response like:
status: '401 Unauthorized',
'content-type': 'application/json; charset=utf-8',
body: 'HTTP Basic: Access denied.\n',
But regardless because Chargify claims this is "application/json" we try to parse it as JSON and so the resulting error is just something like:
Uncaught SyntaxError: Unexpected token H in JSON at position 0
instead of something more related to the 401 which would be more helpful.
I wonder if older versions of the request module used to flag non-2xx responses like this as an err to our callback? Or if this is a temporary bug on Chargify's side?