From cacd2fbef6e354089aba2ff3f3de029c779b62e8 Mon Sep 17 00:00:00 2001 From: George He Date: Fri, 20 Dec 2024 10:27:53 +0800 Subject: [PATCH] fix: doesn't expose the best cert in request interface --- packages/insomnia-sdk/src/objects/insomnia.ts | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/packages/insomnia-sdk/src/objects/insomnia.ts b/packages/insomnia-sdk/src/objects/insomnia.ts index eb41bd02c4..c58b283d4c 100644 --- a/packages/insomnia-sdk/src/objects/insomnia.ts +++ b/packages/insomnia-sdk/src/objects/insomnia.ts @@ -167,18 +167,18 @@ export async function initInsomniaObject( localVars: localVariables, }); - const existClientCert = rawObj.clientCertificates != null && rawObj.clientCertificates.length > 0; - const certificate = existClientCert && rawObj.clientCertificates[0] ? - { - disabled: rawObj.clientCertificates[0].disabled, - name: 'The first certificate from Settings', - matches: [rawObj.clientCertificates[0].host], - key: { src: rawObj.clientCertificates[0].key || '' }, - cert: { src: rawObj.clientCertificates[0].cert || '' }, - passphrase: rawObj.clientCertificates[0].passphrase || undefined, - pfx: { src: rawObj.clientCertificates[0].pfx || '' }, // PFX or PKCS12 Certificate - } : - { disabled: true }; + // const existClientCert = rawObj.clientCertificates != null && rawObj.clientCertificates.length > 0; + // const certificate = existClientCert && rawObj.clientCertificates[0] ? + // { + // disabled: rawObj.clientCertificates[0].disabled, + // name: 'The first certificate from Settings', + // matches: [rawObj.clientCertificates[0].host], + // key: { src: rawObj.clientCertificates[0].key || '' }, + // cert: { src: rawObj.clientCertificates[0].cert || '' }, + // passphrase: rawObj.clientCertificates[0].passphrase || undefined, + // pfx: { src: rawObj.clientCertificates[0].pfx || '' }, // PFX or PKCS12 Certificate + // } : + // { disabled: true }; const proxy = transformToSdkProxyOptions( rawObj.settings.httpProxy, @@ -204,7 +204,9 @@ export async function initInsomniaObject( body: toScriptRequestBody(rawObj.request.body), auth: toPreRequestAuth(rawObj.request.authentication), proxy, - certificate, + // the certificate is undefined + // as it is difficult to find the best cert before rendering + certificate: undefined, pathParameters: rawObj.request.pathParameters, }; const request = new ScriptRequest(reqOpt);