update
This commit is contained in:
parent
259f9f1a10
commit
6bb1bbc632
18
server.js
18
server.js
@ -34,7 +34,10 @@ function getUrl (req, res) {
|
||||
logger.info('>> getting url');
|
||||
function urlQuery (callback) {
|
||||
try {
|
||||
http.request(options).on('response', response => {
|
||||
http.request(options, (response) => {
|
||||
console.log(`STATUS: ${response.statusCode}`);
|
||||
console.log(`HEADERS: ${JSON.stringify(response.headers)}`);
|
||||
response.setEncoding('utf8');
|
||||
let data = '';
|
||||
response.on('data', chunk => {
|
||||
data += chunk;
|
||||
@ -46,6 +49,19 @@ function getUrl (req, res) {
|
||||
logger.error(e);
|
||||
});
|
||||
}).end();
|
||||
|
||||
/*http.request(options).on('response', response => {
|
||||
let data = '';
|
||||
response.on('data', chunk => {
|
||||
data += chunk;
|
||||
});
|
||||
response.on('end', () => {
|
||||
callback(data);
|
||||
});
|
||||
response.on('error', e => {
|
||||
logger.error(e);
|
||||
});
|
||||
}).end();*/
|
||||
}
|
||||
catch (e) {
|
||||
logger.error(e);
|
||||
|
Loading…
Reference in New Issue
Block a user