So what I am trying to do is to parse this XML-based RSS feed on Meteor server-side using standard HTTP package. The confusion is that I receive an empty content in response if called from the server, but if I call the same endpoint from the client then I receive a normal XML content. I tried to call the server method both from a client using Meteor.call and also I tried to call it using meteor shell. Same result
Here is the Meteor method:
readRssFeed: function() {
try {
HTTP.get("http://agenda.regiolive.ch/feed/", {}, function(error, response) {
console.log(response)
//parse xml
});
} catch (error) {
console.log(error);
}
},
The response is:
I20170514-15:20:06.474(3)? { statusCode: 200,
I20170514-15:20:06.474(3)? content: '',
I20170514-15:20:06.474(3)? headers:
I20170514-15:20:06.474(3)? { date: 'Sun, 14 May 2017 12:12:04 GMT',
I20170514-15:20:06.474(3)? server: 'Apache-Coyote/1.1',
I20170514-15:20:06.474(3)? 'access-control-allow-origin': '*',
I20170514-15:20:06.474(3)? 'content-type': 'application/xml;charset=UTF-8',
I20170514-15:20:06.474(3)? 'content-length': '0',
I20170514-15:20:06.474(3)? 'set-cookie':
I20170514-15:20:06.474(3)? [ 'cfid=9d25f146-1fca-42d2-927e-88fb9e458bfa;Path=/;Expires=Mon, 13-May-2047 20:03:34 GMT;HTTPOnly',
I20170514-15:20:06.475(3)? 'cftoken=0;Path=/;Expires=Mon, 13-May-2047 20:03:34 GMT;HTTPOnly',
I20170514-15:20:06.475(3)? 'CF_CLIENT_AGENDA_REGIOLIVE_CH1104_LV=1494764405749;Path=/;Expires=Wed, 24-May-2017 12:20:06 GMT',
I20170514-15:20:06.475(3)? 'CF_CLIENT_AGENDA_REGIOLIVE_CH1104_TC=1494764405749;Path=/;Expires=Wed, 24-May-2017 12:20:06 GMT',
I20170514-15:20:06.475(3)? 'CF_CLIENT_AGENDA_REGIOLIVE_CH1104_HC=2;Path=/;Expires=Wed, 24-May-2017 12:20:06 GMT' ],
I20170514-15:20:06.475(3)? 'keep-alive': 'timeout=5, max=100',
I20170514-15:20:06.475(3)? connection: 'Keep-Alive' },
I20170514-15:20:06.475(3)? data: null }
If I execute the same code on client, I receive the expected response with the XML content
{
"statusCode": 200,
"content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<feed xmlns=\"http://www.w3.org/2005/Atom\"\nxmlns:ev=\"http://purl.org/rss/1.0/modules/event/\"\nxmlns:geo=\"http://www.w3.org/2003/01/g.....>,
"headers": {
"content-type": "application/xml;charset=UTF-8"
},
"data": null
}
I also tried to use a Node.js-style HTTP request. Same result
via brmk
No comments:
Post a Comment