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

Request lib doesn't handle undefined response body properly #9

Open
rmiyashiro opened this issue Sep 26, 2016 · 0 comments
Open

Request lib doesn't handle undefined response body properly #9

rmiyashiro opened this issue Sep 26, 2016 · 0 comments

Comments

@rmiyashiro
Copy link
Contributor

If the body of the response is undefined, Request will call JSON.parse() on it and ignore the resulting exception:

https://github.com/request/request/blob/master/request.js#L1038-L1042

Also, if the json: true option is not used, Request will convert any undefined body into an empty string:

https://github.com/request/request/blob/master/request.js#L1045-L1047

Not sure if that second one is really a problem. It's just a little odd. The first issue could easily be addressed by just doing some simple checks before calling parse() though.

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