Socket
Socket
Sign inDemoInstall

@octokit/rest

Package Overview
Dependencies
Maintainers
3
Versions
297
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@octokit/rest - npm Package Compare versions

Comparing version 15.1.5 to 15.1.6

38

lib/get-request-agent.js
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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc