mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-22 07:53:34 +01:00
Merge branch 'main' of github.com:usebruno/bruno
This commit is contained in:
commit
cee8073bb7
@ -47,25 +47,29 @@ const runSingleRequest = async function (filename, bruJson, collectionPath, coll
|
|||||||
|
|
||||||
const options = getOptions();
|
const options = getOptions();
|
||||||
const insecure = get(options, 'insecure', false);
|
const insecure = get(options, 'insecure', false);
|
||||||
|
const httpsAgentRequestFields = {};
|
||||||
if(insecure) {
|
if(insecure) {
|
||||||
request.httpsAgent = new https.Agent({
|
httpsAgentRequestFields['rejectUnauthorized'] = false;
|
||||||
rejectUnauthorized: false
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const cacert = options['cacert'];
|
const cacertArray = [options['cacert'], process.env.SSL_CERT_FILE, process.env.NODE_EXTRA_CA_CERTS];
|
||||||
if (cacert && cacert.length > 1) {
|
const cacert = cacertArray.find(el => el);
|
||||||
|
if(cacert && cacert.length > 1) {
|
||||||
try {
|
try {
|
||||||
caCrt = fs.readFileSync(cacert)
|
caCrt = fs.readFileSync(cacert);
|
||||||
request.httpsAgent = new https.Agent({
|
httpsAgentRequestFields['ca'] = caCrt;
|
||||||
ca: caCrt
|
|
||||||
});
|
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.log('Error reading CA cert file:' + cacert, err);
|
console.log('Error reading CA cert file:' + cacert, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Object.keys(httpsAgentRequestFields).length > 0) {
|
||||||
|
request.httpsAgent = new https.Agent({
|
||||||
|
...httpsAgentRequestFields
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// stringify the request url encoded params
|
// stringify the request url encoded params
|
||||||
if(request.headers['content-type'] === 'application/x-www-form-urlencoded') {
|
if(request.headers['content-type'] === 'application/x-www-form-urlencoded') {
|
||||||
request.data = qs.stringify(request.data);
|
request.data = qs.stringify(request.data);
|
||||||
|
@ -153,10 +153,27 @@ const registerNetworkIpc = (mainWindow, watcher, lastOpenedCollections) => {
|
|||||||
|
|
||||||
const preferences = getPreferences();
|
const preferences = getPreferences();
|
||||||
const sslVerification = get(preferences, 'request.sslVerification', true);
|
const sslVerification = get(preferences, 'request.sslVerification', true);
|
||||||
|
const httpsAgentRequestFields = {};
|
||||||
if(!sslVerification) {
|
if(!sslVerification) {
|
||||||
|
httpsAgentRequestFields['rejectUnauthorized'] = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const cacertArray = [preferences['cacert'], process.env.SSL_CERT_FILE, process.env.NODE_EXTRA_CA_CERTS];
|
||||||
|
cacertFile = cacertArray.find(el => el);
|
||||||
|
if(cacertFile && cacertFile.length > 1) {
|
||||||
|
try {
|
||||||
|
const fs = require('fs');
|
||||||
|
caCrt = fs.readFileSync(cacertFile);
|
||||||
|
httpsAgentRequestFields['ca'] = caCrt;
|
||||||
|
} catch(err) {
|
||||||
|
console.log('Error reading CA cert file:' + cacertFile, err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Object.keys(httpsAgentRequestFields).length > 0) {
|
||||||
request.httpsAgent = new https.Agent({
|
request.httpsAgent = new https.Agent({
|
||||||
rejectUnauthorized: false
|
...httpsAgentRequestFields
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user