Skip to content

Commit a825c57

Browse files
committed
Fixed File Retrieval with Token
1 parent f0b71c0 commit a825c57

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

localserver.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ function getFileData(url, token=null) {
102102
};
103103
if (token) {
104104
options.headers['X-authorization'] = token;
105-
console.log('getFileData with token')
106105
}
107106
request.get(options, function (error, response, body) {
108107
if (!error && response.statusCode == 200) {

server.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,16 @@ app.post('/Run', async (req, res) => {
9393
}
9494
})
9595

96-
function getFileData(url) {
96+
function getFileData(url, token=null) {
9797
return new Promise((resolve, reject) => {
98-
request.get(url, function (error, response, body) {
98+
const options = {
99+
url: url,
100+
headers: {}
101+
};
102+
if (token) {
103+
options.headers['X-authorization'] = token;
104+
}
105+
request.get(options, function (error, response, body) {
99106
if (!error && response.statusCode == 200) {
100107
return resolve(body);
101108
} else {

0 commit comments

Comments
 (0)