Skip to content

TypeError thrown when response status is 204 No Content #16

@ajlozier

Description

@ajlozier

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions