diff --git a/packages/bruno-app/src/components/CollectionSettings/ClientCertSettings/index.js b/packages/bruno-app/src/components/CollectionSettings/ClientCertSettings/index.js index 0bc91b5c3..7ae9ac85e 100644 --- a/packages/bruno-app/src/components/CollectionSettings/ClientCertSettings/index.js +++ b/packages/bruno-app/src/components/CollectionSettings/ClientCertSettings/index.js @@ -25,7 +25,10 @@ const ClientCertSettings = ({ root, clientCertConfig, onUpdate, onRemove }) => { passphrase: '' }, validationSchema: Yup.object({ - domain: Yup.string().required(), + domain: Yup.string() + .required() + .trim() + .test('not-empty-after-trim', 'Domain is required', value => value && value.trim().length > 0), type: Yup.string().required().oneOf(['cert', 'pfx']), certFilePath: Yup.string().when('type', { is: (type) => type == 'cert', @@ -45,7 +48,7 @@ const ClientCertSettings = ({ root, clientCertConfig, onUpdate, onRemove }) => { let relevantValues = {}; if (values.type === 'cert') { relevantValues = { - domain: values.domain, + domain: values.domain?.trim(), type: values.type, certFilePath: values.certFilePath, keyFilePath: values.keyFilePath, @@ -53,7 +56,7 @@ const ClientCertSettings = ({ root, clientCertConfig, onUpdate, onRemove }) => { }; } else { relevantValues = { - domain: values.domain, + domain: values.domain?.trim(), type: values.type, pfxFilePath: values.pfxFilePath, passphrase: values.passphrase @@ -127,15 +130,20 @@ const ClientCertSettings = ({ root, clientCertConfig, onUpdate, onRemove }) => { - +
+
+ https:// +
+ +
{formik.touched.domain && formik.errors.domain ? (
{formik.errors.domain}
) : null} diff --git a/packages/bruno-electron/src/utils/proxy-util.js b/packages/bruno-electron/src/utils/proxy-util.js index dc249f493..dc8dd5382 100644 --- a/packages/bruno-electron/src/utils/proxy-util.js +++ b/packages/bruno-electron/src/utils/proxy-util.js @@ -88,15 +88,12 @@ function createTimelineAgentClass(BaseAgentClass) { return class extends BaseAgentClass { constructor(options, timeline) { // For proxy agents, the first argument is the proxy URI and the second is options - if (options.proxy || typeof options === 'string') { - const proxyUri = typeof options === 'string' ? options : options.proxy; - const agentOptions = typeof options === 'string' ? {} : { ...options }; - delete agentOptions.proxy; - + if (options?.proxy) { + const { proxy: proxyUri, ...agentOptions } = options; // Ensure TLS options are properly set const tlsOptions = { ...agentOptions, - rejectUnauthorized: agentOptions.rejectUnauthorized !== undefined ? agentOptions.rejectUnauthorized : true, + rejectUnauthorized: agentOptions.rejectUnauthorized ?? true, }; super(proxyUri, tlsOptions); this.timeline = Array.isArray(timeline) ? timeline : []; @@ -109,12 +106,19 @@ function createTimelineAgentClass(BaseAgentClass) { type: 'info', message: `SSL validation: ${tlsOptions.rejectUnauthorized ? 'enabled' : 'disabled'}`, }); + + // Log the proxy details + this.timeline.push({ + timestamp: new Date(), + type: 'info', + message: `Using proxy: ${proxyUri}`, + }); } else { // This is a regular HTTPS agent case const tlsOptions = { ...options, - rejectUnauthorized: options.rejectUnauthorized !== undefined ? options.rejectUnauthorized : true, - }; + rejectUnauthorized: options.rejectUnauthorized ?? true, + }; super(tlsOptions); this.timeline = Array.isArray(timeline) ? timeline : []; this.alpnProtocols = options.ALPNProtocols || ['h2', 'http/1.1']; @@ -129,6 +133,7 @@ function createTimelineAgentClass(BaseAgentClass) { } } + createConnection(options, callback) { const { host, port } = options; @@ -343,7 +348,7 @@ function setupProxyAgents({ try { if (https_proxy?.length) { new URL(https_proxy); - const TimelineHttpsProxyAgent = createTimelineAgentClass(HttpsProxyAgent); + const TimelineHttpsProxyAgent = createTimelineAgentClass(PatchedHttpsProxyAgent); requestConfig.httpsAgent = new TimelineHttpsProxyAgent( { proxy: https_proxy,...tlsOptions }, timeline