This commit is contained in:
Tben 2023-05-06 13:18:44 +01:00
parent 1eb11ede15
commit 224dbf4175
5 changed files with 142 additions and 135 deletions

View File

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

View File

@ -35,12 +35,17 @@ module.exports = async function ({ key, payload, 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) => {
https const reqPayload = JSON.stringify({
.request( payload,
database,
});
const httpsRequest = https.request(
{ {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
"Content-Length": reqPayload.length,
Authorization: key, Authorization: key,
}, },
port: 443, port: 443,
@ -68,14 +73,9 @@ module.exports = async function ({ key, payload, database }) {
reject(err); reject(err);
}); });
} }
) );
.write( httpsRequest.write(reqPayload);
JSON.stringify({ httpsRequest.end();
payload,
database,
})
)
.end();
}); });
/** ********************************************** */ /** ********************************************** */

View File

@ -72,12 +72,17 @@ module.exports = async function ({ key, payload, database, response, encryptionK
* @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) => {
https const reqPayload = JSON.stringify({
.request( payload,
database,
});
const httpsRequest = https.request(
{ {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
"Content-Length": reqPayload.length,
Authorization: key, Authorization: key,
}, },
port: 443, port: 443,
@ -105,14 +110,10 @@ module.exports = async function ({ key, payload, database, response, encryptionK
reject(err); reject(err);
}); });
} }
) );
.write(
JSON.stringify({ httpsRequest.write(reqPayload);
payload, httpsRequest.end();
database,
})
)
.end();
}); });
/** ********************************************** */ /** ********************************************** */

View File

@ -34,12 +34,14 @@ module.exports = async function ({ key, payload }) {
* @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) => {
https const reqPayload = JSON.stringify(payload);
.request(
const httpsRequest = https.request(
{ {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
"Content-Length": reqPayload.length,
Authorization: key, Authorization: key,
}, },
port: 443, port: 443,
@ -67,9 +69,10 @@ module.exports = async function ({ key, payload }) {
reject(err); reject(err);
}); });
} }
) );
.write(JSON.stringify(payload))
.end(); httpsRequest.write(reqPayload);
httpsRequest.end();
}); });
/** ********************************************** */ /** ********************************************** */

View File

@ -31,12 +31,14 @@ module.exports = async function ({ key, payload }) {
* @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) => {
https const reqPayload = JSON.stringify(payload);
.request(
const httpsRequest = https.request(
{ {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
"Content-Length": reqPayload.length,
Authorization: key, Authorization: key,
}, },
port: 443, port: 443,
@ -64,9 +66,10 @@ module.exports = async function ({ key, payload }) {
reject(err); reject(err);
}); });
} }
) );
.write(JSON.stringify(payload))
.end(); httpsRequest.write(reqPayload);
httpsRequest.end();
}); });
/** ********************************************** */ /** ********************************************** */