in packages/metro-cache/src/stores/HttpStore.js [53:93]
constructor(options: Options) {
const uri = url.parse(options.endpoint);
const module = uri.protocol === 'http:' ? http : https;
const agentConfig: http$agentOptions = {
family: options.family,
keepAlive: true,
keepAliveMsecs: options.timeout || 5000,
maxSockets: 64,
maxFreeSockets: 64,
};
if (options.key != null) {
// $FlowFixMe `key` is missing in the Flow definition
agentConfig.key = options.key;
}
if (options.cert != null) {
// $FlowFixMe `cert` is missing in the Flow definition
agentConfig.cert = options.cert;
}
if (options.ca != null) {
// $FlowFixMe `ca` is missing in the Flow definition
agentConfig.ca = options.ca;
}
if (!uri.hostname || !uri.pathname) {
throw new TypeError('Invalid endpoint: ' + options.endpoint);
}
this._module = module;
this._timeout = options.timeout || 5000;
this._host = uri.hostname;
this._path = uri.pathname;
this._port = +uri.port;
this._getAgent = new module.Agent(agentConfig);
this._setAgent = new module.Agent(agentConfig);
}