2018-06-19 01:39:19 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
//var request = require('urequest');
|
|
|
|
var request = require('../');
|
|
|
|
|
|
|
|
// will redirect to https://www.github.com and then https://github.com
|
2018-06-19 06:17:04 +00:00
|
|
|
//request('http://www.github.com', function (error, response, body) {
|
2021-01-14 23:07:48 +00:00
|
|
|
request(
|
|
|
|
{ uri: { protocol: 'http:', hostname: 'www.github.com' } },
|
|
|
|
function (error, response, body) {
|
|
|
|
if (error) {
|
|
|
|
console.log('error:', error); // Print the error if one occurred
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
console.log('statusCode:', response.statusCode); // The final statusCode
|
|
|
|
console.log('Final href:', response.request.uri.href); // The final URI
|
|
|
|
console.log('Body Length:', body.length); // body length
|
2019-10-29 20:31:30 +00:00
|
|
|
}
|
2021-01-14 23:07:48 +00:00
|
|
|
);
|