Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CLI for Appwrite version 1.3 #639

Merged
merged 12 commits into from
Apr 11, 2023
10 changes: 5 additions & 5 deletions templates/cli/lib/client.js.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const os = require('os');
const https = require("https");
const axios = require("axios");
const JSONbig = require("json-bigint")({ storeAsString: false });
const FormData = require("form-data");
Expand Down Expand Up @@ -100,11 +101,6 @@ class Client {
params = {},
responseType = "json"
) {
if (this.selfSigned == true) {
// Allow self signed requests
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
}

headers = Object.assign({}, this.headers, headers);

let contentType = headers["content-type"].toLowerCase();
Expand Down Expand Up @@ -140,6 +136,10 @@ class Client {
transformResponse: [ (data) => data ? JSONbig.parse(data) : data ],
responseType: responseType,
};
if (this.selfSigned == true) {
// Allow self signed requests
options.httpsAgent = new https.Agent({ rejectUnauthorized: false });
}
try {
let response = await axios(options);
if (response.headers["set-cookie"]) {
Expand Down
Loading