@octokit/rest
Advanced tools
Comparing version 15.0.4 to 15.1.0
module.exports = { | ||
ca: undefined, | ||
family: undefined, // 4 for v4, 6 for v6 | ||
agent: undefined, // https://nodejs.org/api/https.html#https_class_https_agent | ||
headers: {}, | ||
@@ -9,6 +8,4 @@ host: 'api.github.com', | ||
protocol: 'https', | ||
proxy: undefined, | ||
rejectUnauthorized: true, | ||
requestMedia: 'application/vnd.github.v3+json', | ||
timeout: 0 | ||
} |
@@ -6,2 +6,3 @@ module.exports = parseOptions | ||
const getRequestAgent = require('./get-request-agent') | ||
const DEFAULTS = require('./defaults') | ||
@@ -14,24 +15,21 @@ const OPTION_NAMES = [ | ||
'port', | ||
'proxy', | ||
'ca', | ||
'agent', | ||
'headers', | ||
'requestMedia', | ||
'rejectUnauthorized', | ||
'family' | ||
'requestMedia' | ||
] | ||
function parseOptions (options) { | ||
if (!options) { | ||
options = {} | ||
function parseOptions (userOptions) { | ||
if (!userOptions) { | ||
userOptions = {} | ||
} | ||
if ('followRedirects' in options) { | ||
if ('followRedirects' in userOptions) { | ||
console.warn('DEPRECATED: followRedirects option is no longer supported. All redirects are followed correctly') | ||
} | ||
if ('Promise' in options) { | ||
if ('Promise' in userOptions) { | ||
console.warn('DEPRECATED: Promise option is no longer supported. The native Promise API is used') | ||
} | ||
options = defaults(pick(options, OPTION_NAMES), DEFAULTS) | ||
const options = defaults(pick(userOptions, OPTION_NAMES), DEFAULTS) | ||
@@ -41,6 +39,2 @@ const clientDefaults = { | ||
request: { | ||
ca: options.ca, | ||
family: options.family, | ||
proxy: options.proxy, | ||
rejectUnauthorized: options.rejectUnauthorized, | ||
timeout: options.timeout | ||
@@ -61,3 +55,8 @@ } | ||
/* istanbul ignore else */ | ||
if (!process.browser) { | ||
clientDefaults.request.agent = getRequestAgent(userOptions) | ||
} | ||
return clientDefaults | ||
} |
@@ -20,4 +20,5 @@ 'use strict' | ||
url.parse(origRequestOptions.url), | ||
pick(origRequestOptions, 'method', 'body', 'headers', 'ca', 'family', 'proxy', 'rejectUnauthorized', 'timeout') | ||
pick(origRequestOptions, 'method', 'body', 'headers', 'agent', 'timeout') | ||
) | ||
debug('REQUEST:', requestOptions) | ||
@@ -24,0 +25,0 @@ |
{ | ||
"name": "@octokit/rest", | ||
"version": "15.0.4", | ||
"version": "15.1.0", | ||
"publishConfig": { | ||
@@ -49,2 +49,3 @@ "access": "public", | ||
"@octokit/fixtures-server": "^2.0.1", | ||
"@types/node": "^9.4.6", | ||
"apidoc": "^0.17.6", | ||
@@ -74,3 +75,3 @@ "bundlesize": "^0.16.0", | ||
"typescript": "^2.6.2", | ||
"webpack": "^4.0.0-beta.2", | ||
"webpack": "^4.0.0", | ||
"webpack-bundle-analyzer": "^2.10.0", | ||
@@ -80,3 +81,4 @@ "webpack-cli": "^2.0.4" | ||
"browser": { | ||
"./lib/request/request.js": "./lib/request/request-browser.js" | ||
"./lib/request/request.js": "./lib/request/request-browser.js", | ||
"./lib/get-request-agent.js": false | ||
}, | ||
@@ -140,4 +142,6 @@ "types": "index.d.ts", | ||
"describe", | ||
"before", | ||
"beforeEach", | ||
"afterEach", | ||
"after", | ||
"it", | ||
@@ -144,0 +148,0 @@ "expect", |
@@ -71,8 +71,4 @@ # rest.js [![@latest](https://img.shields.io/npm/v/@octokit/rest.svg)](https://www.npmjs.com/package/@octokit/rest) [![@next](https://img.shields.io/npm/v/@octokit/rest/next.svg?label=@next)](https://www.npmjs.com/package/@octokit/rest) | ||
// advanced request options | ||
// see https://nodejs.org/api/http.html | ||
proxy: undefined, | ||
ca: undefined, | ||
rejectUnauthorized: undefined, | ||
family: undefined | ||
// Node only: advanced request options can be passed as http(s) agent | ||
agent: undefined | ||
}) | ||
@@ -79,0 +75,0 @@ ``` |
Sorry, the diff of this file is too big to display
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance 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
564826
39
14767
29
205
2