Hi all
Is there something different in how Parse.Cloud.httpRequest is handling compression ?
On parse.com, I never had an issue with receiving a XML file, but using parse server on a different host (back4app), my httpResponse.text is a load of: �E��ڇ�*q�������y���v^�����
Parse.Cloud.job("fetchData", function(request, status) {
Parse.Cloud.httpRequest({
method: 'GET',
url: 'http://example.com/test.xml',
headers: {
'Accept': 'application/xml',
'Accept-Encoding': 'gzip, deflate'
},
success: function (httpResponse) {
console.log("SUCCESS RECD FILE: " + httpResponse.text);
},
error: function (httpResponse) {
console.log('An error has occured with the http request.: ' + httpResponse);
}
});
}
Can anyone help me please ?
Best wishes
You really should consider using the request npm module instead of parse "proxy" of it. Also, this question is more suited for SO or the likes.
Closing this as posted on stack overflow
To anyone having this issue, here is the solution.
The option gzip:true is not documented anywhere.
Parse.Cloud.httpRequest({
url: 'http://example.com/feed.xml',
headers: {
'Content-Type': 'application/json',
'Accept-Encoding': 'gzip, deflate'
},
gzip:true,
success: function (httpResponse) {
...
},
error: function (httpResponse) {
...
}
}
Thanks johnnyzen, perfect answer!
Most helpful comment
To anyone having this issue, here is the solution.
The option gzip:true is not documented anywhere.