Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError thrown when response status is 204 No Content #16

Closed
ajlozier opened this issue Feb 12, 2019 · 1 comment
Closed

TypeError thrown when response status is 204 No Content #16

ajlozier opened this issue Feb 12, 2019 · 1 comment

Comments

@ajlozier
Copy link
Contributor

When making a call such as:

hyperwalletManager.getHyperwallet().listUsers({ "email" : emailAddress }, function(err, users){
   ...
});

A TypeError is thrown when no results are returned, due to the fact that the 204 No Content response does not include a "Content-Type" header.

TypeError: Cannot read property 'indexOf' of undefined
      at /Users/aaron/WaitrInc/hyperwallet-node-sdk/src/utils/ApiClient.js:175:88

The following conditional does not check the status code before executing indexOf against the non-existent res.header["content-type"] array.

https://github.com/hyperwallet/node-sdk/blob/master/src/utils/ApiClient.js#L175

I have a PR which fixes this issue and also includes an additional test to cover this case.

@ajlozier
Copy link
Contributor Author

ajlozier commented Apr 8, 2019

This issue still seems to be present in the npm module. Is there a build pending?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant