on the freshdesk app while doing local testing (http://localhost:10001 server) for a post request we get this response:
{“status”:502,“headers”:{},“response”:“Error in establishing connection”,“errorSource”:“APP”,“attempts”:1}.
Although when we do the same request outside freshdesk … we get a response back from the server.
here is the code making the request ... note that same code used to work fine for a long period .. not sure if its related to the sdk update ?
`
var headers = {"Authorization": "Basic <%= encode(iparam.freshdeskApiKey) %>" };
var options = (ajaxObject.external)? { headers: headers } : {};
options.body = someData;
client.request.post(ajaxObject.url, options)
.then(
function(data) {
//handle "data"
//"data" is a json string with status, headers, and response.
if (ajaxObject.success) {
ajaxObject.success(Utils.AutoParse(data.response)); // a function that take the server time parameter on success of the ajax
}
},
function(err) {
//handle failure
console.error(err);
ajaxObject.error(err);
}
);