How can I get the Meteor HTTP.call (or get) method to change the headers of an HTTP request?

I am trying to speed up the Meteor application by loading enough web page content to get <head>my HTML tag to get its name, image and description. I have a client calling the server method with the following code:

Meteor.call("metaGetter", url, function(err, res){...});

And on the server side, in the method metaGetter, I use Meteor HTTP.call:

var result = HTTP.call('GET', url, {headers: {'content-range': "bytes 0-100"}});

as indicated in the Meteor documentation. I can get the result, html. However, after printing the returned headers, I do not see the attribute content-rangethat I was trying to set.

Edit: Akshat solution works, but only for some websites, in fact, very few. Any help would be greatly appreciated.

+4
source share
2 answers

In general, you cannot have a fixed limit if you want to always get the header:

In general, I would take the whole HTML file. On most decent servers, it takes less than 100 ms. It is unlikely that a person is noticeable. If you do so much, you can allow parallel execution of the parallel method on the server side (see http://docs.meteor.com/#/full/method_unblock )

, , 100 , </title>, HTML.

+1

range:

var result = HTTP.call('GET', url, {headers: {'range': "bytes=0-100"}});

content-range, .

, , . , http://www.microsoft.com url.

, , , .

, - , , , .

+2

All Articles