agent request code example
Example 1: how ot send user agent in nodejs https header
const options = {
hostname: 'www.panda.tv',
path: 'ajax_chatinfo?roomid=89757',
headers: { 'User-Agent': 'Mozilla/5.0' }
};
http.get(options, function(res) {
res.on('data', function(chunk) { console.log(chunk) });
});
Example 2: how ot send user agent in nodejs https header
http.get({ url: 'http://www.panda.tv/ajax_chatinfo?roomid=89757',
agent: 'Mozilla/5.0' }, function(res) {
res.on('data', function(chunk) {
doSomething();
});
});