aacerox / node-rest-client

REST API client from node.js
MIT License
376 stars 132 forks source link

Handle JSON Hijacking prevention #189

Open vMarkusK opened 6 years ago

vMarkusK commented 6 years ago

Hello,

I try to use node-rest-client for JIVE API. JIVE Uses JSON Hijacking prevention: https://community.jivesoftware.com/community/developer/blog/2015/06/29/throw-allowillegalresourcecall-to-the-curb-is-true

An Idea how to handle the JSON Paring error?

My Example Code: var Client = require('node-rest-client').Client; var client = new Client(); var selectedText = "Test" var args = { headers: { "Accept": "application/json" } }; var Url = "https://communities.vmware.com/api/core/v3/search/contents?count=1&filter=search(" + selectedText + ")&sort=relevanceDesc&returnScore=true&filter=type(discussion)" // direct way client.get(Url, args, function (data, response) { // parsed response body as js object console.log(data); // raw response console.log(response); }); `

M1kep commented 6 years ago

It looks like you would need to implement a response parser. It looks like there is some explanation/example in the readme