This commit is contained in:
Tben 2023-05-22 11:17:04 +01:00
parent 91401e2c26
commit a4dc09f725
2 changed files with 17 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "datasquirel", "name": "datasquirel",
"version": "1.1.17", "version": "1.1.18",
"description": "Cloud-based SQL data management tool", "description": "Cloud-based SQL data management tool",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -44,11 +44,26 @@ module.exports = async function ({ key, query, database }) {
* @description make a request to datasquirel.com * @description make a request to datasquirel.com
*/ */
const httpResponse = await new Promise((resolve, reject) => { const httpResponse = await new Promise((resolve, reject) => {
const reqPayload = JSON.stringify({ const reqPayloadString = JSON.stringify({
query, query,
database, database,
}).replace(/\n|\r|\n\r/gm, ""); }).replace(/\n|\r|\n\r/gm, "");
try {
JSON.parse(reqPayloadString);
} catch (error) {
console.log(error);
console.log(reqPayloadString);
return {
success: false,
payload: null,
error: "Query object is invalid. Please Check query data values",
};
}
const reqPayload = reqPayloadString;
const httpsRequest = https.request( const httpsRequest = https.request(
{ {
method: "POST", method: "POST",