const setupHTTPClient = () => { if (httpConfig.useCertFile) { if (httpConfig.certFile !== undefined) { https.globalAgent.options.ca = [fs.readFileSync(httpConfig.certFile)]; log.info('Loaded cert file:', httpConfig.certFile); } } http.globalAgent.keepAlive = httpConfig.keepAlive; https.globalAgent.keepAlive = httpConfig.keepAlive; }
_.forEach(userDefinedCAStores, store => { https.globalAgent.options.ca.push(Fs.readFileSync(store)); });
https.globalAgent.options.ca = cas;
https.globalAgent.options.ca = []; httpConfig.keepAlive = false; httpConfig.useCertFile = false; httpConfig.certFile = certFile; expect(https.globalAgent.options.ca).to.have.lengthOf(0); setupHTTPClient(); expect(https.globalAgent.options.ca).to.have.lengthOf(1); }); httpConfig.certFile = certFile; expect(https.globalAgent.options.ca).to.have.lengthOf(0); setupHTTPClient(); expect(https.globalAgent.options.ca).to.have.lengthOf(0); }); expect(https.globalAgent.options.ca).to.have.lengthOf(0); setupHTTPClient(); expect(https.globalAgent.options.ca).to.have.lengthOf(0); }); expect(https.globalAgent.options.ca).to.have.lengthOf(0); });