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

Exception when specifying Content-Type header #24

Closed
dpolivy opened this issue Oct 22, 2014 · 3 comments
Closed

Exception when specifying Content-Type header #24

dpolivy opened this issue Oct 22, 2014 · 3 comments

Comments

@dpolivy
Copy link

dpolivy commented Oct 22, 2014

If one specifies a Content-Type header, an unhandled exception will be thrown from here:

https://github.com/Mashape/unirest-nodejs/blob/master/index.js#L527

Cannot call method 'split' of undefined

Basically, the local variable header is the value of the content-type header, so trying to use it as the index into the headers array is incorrect -- and returns an undefined object, which you can't call .split() on.

Seems like the correct fix is to just call header.split() directly?

@nijikokun
Copy link
Contributor

Yes, thank you for bringing this to my attention

@dpolivy
Copy link
Author

dpolivy commented Oct 22, 2014

Thanks for the quick response! I was working on a fix myself, but will just pick up yours instead. Will this be pushed to npm soon?

@nijikokun
Copy link
Contributor

It's already been pushed :)

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

2 participants