feat: added debug logging of response
This commit is contained in:
parent
ab878373f3
commit
4b155b9263
41
index.js
41
index.js
|
@ -6,10 +6,8 @@ const URL=process.env.URL||'https://tarifmatrix.vbn.de:4445/fares/info';
|
||||||
debug('URL: '+URL)
|
debug('URL: '+URL)
|
||||||
|
|
||||||
const USR=process.env.USR||'USR';
|
const USR=process.env.USR||'USR';
|
||||||
debug('USR: '+USR)
|
|
||||||
|
|
||||||
const KEY=process.env.KEY||'KEY';
|
const KEY=process.env.KEY||'KEY';
|
||||||
debug('KEY: '+KEY)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable server authorization only in development mode
|
* Disable server authorization only in development mode
|
||||||
|
@ -43,36 +41,15 @@ async function run() {
|
||||||
password: `${KEY}`
|
password: `${KEY}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
).then(res => res.data);
|
//async example to process responce
|
||||||
// );
|
// ).then(res => {
|
||||||
// res.status; // 200
|
// debug('res.data: %s',res.data)
|
||||||
|
// });
|
||||||
|
);
|
||||||
|
|
||||||
debug('data received via GET');
|
debug('data received via GET');
|
||||||
debug('dataGet len: %s',dataGet.length)
|
debug('dataGet: %s',dataGet)
|
||||||
// debug('dataGet: %s',dataGet)
|
debug('dataGet.data.length: %s',dataGet.data.length)
|
||||||
debug('dataGet: %s',JSON.stringify(dataGet))
|
debug('dataGet.data: %s',dataGet.data)
|
||||||
// debug('res JSON: %s',JSON.stringify(res));
|
debug('dataGet.data[0].extern: %s',dataGet.data[0].extern)
|
||||||
|
|
||||||
/*
|
|
||||||
//HTTP POST
|
|
||||||
|
|
||||||
//url as first,
|
|
||||||
//request body as second and
|
|
||||||
//options as third POST argument
|
|
||||||
//response is returned
|
|
||||||
const res=await axios.post(
|
|
||||||
'http://localhost:3000/user',
|
|
||||||
//'https://dedriver.org/gtfs/realtime',
|
|
||||||
encodedPost,
|
|
||||||
{
|
|
||||||
headers:{
|
|
||||||
'content-type':'application/octet-stream'}
|
|
||||||
// 'content-type':'application/x-protobuf'}
|
|
||||||
//'transformRequest':[]
|
|
||||||
}
|
|
||||||
).then(res => res.data);
|
|
||||||
debug('POST sent');
|
|
||||||
debug('res JSON: %s',JSON.stringify(res));
|
|
||||||
//debug('res content-type: %s',res.data.headers['content-type']);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue