-
Notifications
You must be signed in to change notification settings - Fork 132
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
json parsing of response #12
Comments
Hi you can customize content type of the response by setting the parameter "mimetypes" in the options passed to client. in your case it would be: var options ={
// customize mime types for json or xml connections
//(in your case with a space between type and charset)
mimetypes:{
json:["application/json","application/json; charset=utf-8"],
xml:["application/xml","application/xml; charset=utf-8"]
}
};
Client client = new Client(options) For more info on client options customization please see https://github.com/aacerox/node-rest-client#options-parameters |
sorry this line Client client = new Client(options) is wrong, I wrote it in Java ;) the correct way would be var client = new Client(options) |
This was referenced Apr 20, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To perform JSON parsing of response, the code checks of "jsonctype":["application/json","application/json;charset=utf-8"], in response header.
Its failing for me becuase in my case. the rest endpoint returns content header as "application/json; charset=utf-8" (notice the space between encoding directive).
May be the better approach would be to split the string and look for "application/json"
The text was updated successfully, but these errors were encountered: