mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-07 16:44:27 +01:00
feat(#168): disable ssl option
This commit is contained in:
parent
d62881fe0d
commit
a1c9625aee
@ -2,6 +2,12 @@
|
||||
* The preferences are stored in the browser local storage.
|
||||
* When the app is started, an IPC message is published from the renderer process to set the preferences.
|
||||
* The electron process uses this module to get the preferences.
|
||||
*
|
||||
* {
|
||||
* request: {
|
||||
* sslVerification: boolean
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
|
||||
let preferences = {};
|
||||
@ -11,8 +17,6 @@ const getPreferences = () => {
|
||||
}
|
||||
|
||||
const setPreferences = (newPreferences) => {
|
||||
console.log('setting preferences');
|
||||
console.log(newPreferences);
|
||||
preferences = newPreferences;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
const qs = require('qs');
|
||||
const https = require('https');
|
||||
const axios = require('axios');
|
||||
const Mustache = require('mustache');
|
||||
const FormData = require('form-data');
|
||||
@ -11,6 +12,7 @@ const { cancelTokens, saveCancelToken, deleteCancelToken } = require('../../util
|
||||
const { uuid } = require('../../utils/common');
|
||||
const interpolateVars = require('./interpolate-vars');
|
||||
const { sortFolder, getAllRequestsInFolderRecursively } = require('./helper');
|
||||
const { getPreferences } = require('../../app/preferences');
|
||||
|
||||
// override the default escape function to prevent escaping
|
||||
Mustache.escape = function (value) {
|
||||
@ -145,6 +147,15 @@ const registerNetworkIpc = (mainWindow, watcher, lastOpenedCollections) => {
|
||||
cancelTokenUid
|
||||
});
|
||||
|
||||
const preferences = getPreferences();
|
||||
const sslVerification = get(preferences, 'request.sslVerification', true);
|
||||
|
||||
if(!sslVerification) {
|
||||
request.httpsAgent = new https.Agent({
|
||||
rejectUnauthorized: false
|
||||
});
|
||||
}
|
||||
|
||||
const response = await axios(request);
|
||||
|
||||
// run post-response vars
|
||||
@ -245,6 +256,15 @@ const registerNetworkIpc = (mainWindow, watcher, lastOpenedCollections) => {
|
||||
const envVars = getEnvVars(environment);
|
||||
const request = prepareGqlIntrospectionRequest(endpoint, envVars);
|
||||
|
||||
const preferences = getPreferences();
|
||||
const sslVerification = get(preferences, 'request.sslVerification', true);
|
||||
|
||||
if(!sslVerification) {
|
||||
request.httpsAgent = new https.Agent({
|
||||
rejectUnauthorized: false
|
||||
});
|
||||
}
|
||||
|
||||
const response = await axios(request);
|
||||
|
||||
return {
|
||||
@ -371,6 +391,15 @@ const registerNetworkIpc = (mainWindow, watcher, lastOpenedCollections) => {
|
||||
...eventData
|
||||
});
|
||||
|
||||
const preferences = getPreferences();
|
||||
const sslVerification = get(preferences, 'request.sslVerification', true);
|
||||
|
||||
if(!sslVerification) {
|
||||
request.httpsAgent = new https.Agent({
|
||||
rejectUnauthorized: false
|
||||
});
|
||||
}
|
||||
|
||||
// send request
|
||||
timeStart = Date.now();
|
||||
const response = await axios(request);
|
||||
|
Loading…
Reference in New Issue
Block a user