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

Content-Type detection problem #75

Closed
evangelion1204 opened this issue Apr 20, 2015 · 1 comment
Closed

Content-Type detection problem #75

evangelion1204 opened this issue Apr 20, 2015 · 1 comment

Comments

@evangelion1204
Copy link

Hi,

creating a simple REST-Service with express and using this lib I encountered the problem, that the result is not parsed as JSON although one is returned and the content type was set.

Currently the code checks for

"jsonctype":["application/json","application/json;charset=utf-8"]

but express created application/json; charset=utf-8, simply adding a third element in the list is helping in that case or changing the detection with a split and comparing each element after having trimmed it.

If you wish I can drop a PR later, depending which solution you prefer or maybe you have another one in mind.

Kind regards,

Michael

@aacerox
Copy link
Owner

aacerox commented Apr 20, 2015

Hi @evangelion1204

You can set a custom content-type for json or xml using the "mimetypes" initialization parameter. Please refer to documentation (https://github.com/aacerox/node-rest-client#options-parameters) and issues #17 and #12

Thanks.

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