mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-25 21:55:49 +00:00
ca certs function updates (#5555)
This commit is contained in:
@@ -155,7 +155,7 @@ const runSingleRequest = async function (
|
||||
httpsAgentRequestFields['rejectUnauthorized'] = false;
|
||||
} else {
|
||||
const caCertFilePath = options['cacert'];
|
||||
let caCertificatesData = await getCACertificates({ caCertFilePath, shouldKeepDefaultCerts: !options['ignoreTruststore'] });
|
||||
let caCertificatesData = getCACertificates({ caCertFilePath, shouldKeepDefaultCerts: !options['ignoreTruststore'] });
|
||||
let caCertificates = caCertificatesData.caCertificates;
|
||||
httpsAgentRequestFields['ca'] = caCertificates || [];
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ const getCertsAndProxyConfig = async ({
|
||||
}
|
||||
|
||||
let caCertFilePath = preferencesUtil.shouldUseCustomCaCertificate() && preferencesUtil.getCustomCaCertificateFilePath();
|
||||
let caCertificatesData = await getCACertificates({
|
||||
let caCertificatesData = getCACertificates({
|
||||
caCertFilePath,
|
||||
shouldKeepDefaultCerts: preferencesUtil.shouldKeepDefaultCaCertificates()
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@ type T_CACertificatesResult = {
|
||||
|
||||
let systemCertsCache: string[] | undefined;
|
||||
|
||||
async function getSystemCerts(): Promise<string[]> {
|
||||
function getSystemCerts(): string[] {
|
||||
if (systemCertsCache) return systemCertsCache;
|
||||
|
||||
try {
|
||||
@@ -87,10 +87,10 @@ function getNodeExtraCACerts(): string[] {
|
||||
*
|
||||
* @param caCertFilePath - path to custom CA certificate file
|
||||
* @param shouldKeepDefaultCerts - whether to keep default CA certificates
|
||||
* @returns {Promise<T_CACertificatesResult>} - CA certificates and their count
|
||||
* @returns {T_CACertificatesResult} - CA certificates and their count
|
||||
*/
|
||||
|
||||
const getCACertificates = async ({ caCertFilePath, shouldKeepDefaultCerts = true }: T_CACertificatesOptions): Promise<T_CACertificatesResult> => {
|
||||
const getCACertificates = ({ caCertFilePath, shouldKeepDefaultCerts = true }: T_CACertificatesOptions): T_CACertificatesResult => {
|
||||
try {
|
||||
let caCertificates = '';
|
||||
let caCertificatesCount = {
|
||||
@@ -126,7 +126,7 @@ const getCACertificates = async ({ caCertFilePath, shouldKeepDefaultCerts = true
|
||||
|
||||
if (shouldKeepDefaultCerts) {
|
||||
// get system certs
|
||||
systemCerts = await getSystemCerts();
|
||||
systemCerts = getSystemCerts();
|
||||
caCertificatesCount.system = systemCerts.length;
|
||||
|
||||
// get root certs
|
||||
@@ -135,7 +135,7 @@ const getCACertificates = async ({ caCertFilePath, shouldKeepDefaultCerts = true
|
||||
}
|
||||
} else {
|
||||
// get system certs
|
||||
systemCerts = await getSystemCerts();
|
||||
systemCerts = getSystemCerts();
|
||||
caCertificatesCount.system = systemCerts.length;
|
||||
|
||||
// get root certs
|
||||
|
||||
Reference in New Issue
Block a user