This commit is contained in:
Martin Donnelly 2017-09-11 11:47:34 +01:00
parent 259f9f1a10
commit 6bb1bbc632

View File

@ -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);