Bugfix
This commit is contained in:
parent
dfbd4c3557
commit
779881ec6e
11
utils/get.js
11
utils/get.js
@ -116,7 +116,7 @@ async function get({ key, db, query, queryValues, tableName }) {
|
|||||||
path: encodeURIComponent(path),
|
path: encodeURIComponent(path),
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("requestObject =>", requestObject);
|
console.log("scheme =>", scheme);
|
||||||
|
|
||||||
(scheme?.match(/^http$/i) ? http : https)
|
(scheme?.match(/^http$/i) ? http : https)
|
||||||
.request(
|
.request(
|
||||||
@ -135,7 +135,14 @@ async function get({ key, db, query, queryValues, tableName }) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
response.on("end", function () {
|
response.on("end", function () {
|
||||||
resolve(JSON.parse(str));
|
try {
|
||||||
|
resolve(JSON.parse(str));
|
||||||
|
} catch (error) {
|
||||||
|
reject({
|
||||||
|
error: error.message,
|
||||||
|
result: str,
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
response.on("error", (err) => {
|
response.on("error", (err) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user