UNPKG

@splitsoftware/splitio

Version:
26 lines (25 loc) 904 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getOptions = void 0; var tslib_1 = require("tslib"); // @TODO // 1- handle multiple protocols automatically // 2- destroy it once the sdk is destroyed var https_1 = (0, tslib_1.__importDefault)(require("https")); var lang_1 = require("@splitsoftware/splitio-commons/cjs/utils/lang"); var agent = new https_1.default.Agent({ keepAlive: true, keepAliveMsecs: 1500 }); function getOptions(settings) { // User provided options take precedence if (settings.sync.requestOptions) return settings.sync.requestOptions; // If some URL is not HTTPS, we don't use the agent, to let the SDK connect to HTTP endpoints if ((0, lang_1.find)(settings.urls, function (url) { return !url.startsWith('https:'); })) return; return { agent: agent }; } exports.getOptions = getOptions;