@octokit/rest
Advanced tools
Comparing version 15.1.5 to 15.1.6
module.exports = getRequestAgent | ||
const pick = require('lodash/pick') | ||
const urlParse = require('url').parse | ||
const HttpAgent = require('http').Agent | ||
const HttpsAgent = require('https').Agent | ||
const HttpProxyAgent = require('http-proxy-agent') | ||
const HttpsProxyAgent = require('https-proxy-agent') | ||
const merge = require('lodash/merge') | ||
const omit = require('lodash/omit') | ||
const pick = require('lodash/pick') | ||
@@ -12,21 +18,33 @@ function getRequestAgent (options) { | ||
const agentOptions = ['ca', 'proxy', 'rejectUnauthorized', 'family'].filter(key => key in options) | ||
const agentOptionNames = ['ca', 'proxy', 'rejectUnauthorized', 'family'].filter(key => key in options) | ||
if (agentOptions.length === 0) { | ||
if (agentOptionNames.length === 0) { | ||
return | ||
} | ||
agentOptions.forEach(option => { | ||
agentOptionNames.forEach(option => { | ||
console.warn(`options.${option} is deprecated. Use "options.agent" instead`) | ||
}) | ||
var Agent | ||
const agentOptions = pick(options, agentOptionNames) | ||
if ('proxy' in options) { | ||
const proxyAgentOptions = merge( | ||
urlParse(agentOptions.proxy), | ||
omit(agentOptions, 'proxy') | ||
) | ||
if (options.protocol === 'http') { | ||
return new HttpProxyAgent(proxyAgentOptions) | ||
} | ||
return new HttpsProxyAgent(agentOptions) | ||
} | ||
/* istanbul ignore if */ | ||
if (options.protocol && options.protocol === 'http') { | ||
Agent = HttpAgent | ||
} else { | ||
Agent = HttpsAgent | ||
if (options.protocol === 'http') { | ||
return new HttpAgent(agentOptions) | ||
} | ||
return new Agent(pick(options, agentOptions)) | ||
return new HttpsAgent(agentOptions) | ||
} |
module.exports = apiMethod | ||
const clone = require('lodash/clone') | ||
const defaultsDeep = require('lodash/defaultsDeep') | ||
@@ -9,2 +10,5 @@ const mapKeys = require('lodash/mapKeys') | ||
function apiMethod (octokit, endpointDefaults, endpointParams, options, callback) { | ||
// Do not alter passed options (#786) | ||
options = clone(options) | ||
// lowercase header names (#760) | ||
@@ -11,0 +15,0 @@ options.headers = mapKeys(options.headers, (value, key) => key.toLowerCase()) |
{ | ||
"name": "@octokit/rest", | ||
"version": "15.1.5", | ||
"version": "15.1.6", | ||
"publishConfig": { | ||
@@ -42,2 +42,4 @@ "access": "public", | ||
"debug": "^3.1.0", | ||
"http-proxy-agent": "^2.1.0", | ||
"https-proxy-agent": "^2.2.0", | ||
"lodash": "^4.17.4", | ||
@@ -48,2 +50,3 @@ "node-fetch": "^2.1.1", | ||
"devDependencies": { | ||
"@gr2m/node-fetch": "^2.0.0", | ||
"@octokit/fixtures-server": "^2.0.1", | ||
@@ -66,6 +69,7 @@ "@types/node": "^9.4.6", | ||
"nyc": "^11.2.1", | ||
"proxy": "^0.2.4", | ||
"proxyquire": "^2.0.0", | ||
"semantic-release": "^14.0.3", | ||
"sinon": "^4.2.2", | ||
"sinon-chai": "^2.14.0", | ||
"sinon-chai": "^3.0.0", | ||
"standard": "^11.0.0", | ||
@@ -72,0 +76,0 @@ "standard-markdown": "^4.0.2", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
564034
14731
8
30
5
+ Addedhttp-proxy-agent@^2.1.0
+ Addedhttps-proxy-agent@^2.2.0
+ Addedagent-base@4.3.0(transitive)
+ Addeddebug@3.1.0(transitive)
+ Addedes6-promise@4.2.8(transitive)
+ Addedes6-promisify@5.0.0(transitive)
+ Addedhttp-proxy-agent@2.1.0(transitive)
+ Addedhttps-proxy-agent@2.2.4(transitive)
+ Addedms@2.0.0(transitive)