update
This commit is contained in:
parent
5729fd3650
commit
a877c92e53
10
server.js
10
server.js
@ -34,10 +34,18 @@ function getUrl (req, res) {
|
||||
logger.info('>> getting url');
|
||||
function urlQuery (callback) {
|
||||
try {
|
||||
let count = 0;
|
||||
http.request(options, (response) => {
|
||||
console.log(`STATUS: ${response.statusCode}`);
|
||||
console.log(`HEADERS: ${JSON.stringify(response.headers)}`);
|
||||
response.setEncoding('utf8');
|
||||
if (response.statusCode === 302) {
|
||||
body = [];
|
||||
logger.debug('>. follow', response.headers.location, count);
|
||||
count++;
|
||||
request(response.headers.location);
|
||||
}
|
||||
|
||||
let data = '';
|
||||
response.on('data', chunk => {
|
||||
data += chunk;
|
||||
@ -50,7 +58,7 @@ function getUrl (req, res) {
|
||||
});
|
||||
}).end();
|
||||
|
||||
/*http.request(options).on('response', response => {
|
||||
/* http.request(options).on('response', response => {
|
||||
let data = '';
|
||||
response.on('data', chunk => {
|
||||
data += chunk;
|
||||
|
Loading…
Reference in New Issue
Block a user