@octokit/rest
Advanced tools
Comparing version 15.1.9 to 15.2.0
module.exports = { | ||
agent: undefined, // https://nodejs.org/api/https.html#https_class_https_agent | ||
headers: {}, | ||
host: 'api.github.com', | ||
pathPrefix: '', // for GitHub Enterprise | ||
port: undefined, | ||
protocol: 'https', | ||
requestMedia: 'application/vnd.github.v3+json', | ||
timeout: 0 | ||
timeout: 0, | ||
baseUrl: 'https://api.github.com' | ||
} |
@@ -23,3 +23,2 @@ module.exports = getRequestAgent | ||
} | ||
agentOptionNames.forEach(option => { | ||
@@ -31,2 +30,4 @@ console.warn(`options.${option} is deprecated. Use "options.agent" instead`) | ||
const protocol = urlParse(options.baseUrl).protocol.replace(':', '') | ||
if ('proxy' in options) { | ||
@@ -38,3 +39,3 @@ const proxyAgentOptions = merge( | ||
if (options.protocol === 'http') { | ||
if (protocol === 'http') { | ||
return new HttpProxyAgent(proxyAgentOptions) | ||
@@ -47,3 +48,3 @@ } | ||
/* istanbul ignore if */ | ||
if (options.protocol === 'http') { | ||
if (protocol === 'http') { | ||
return new HttpAgent(agentOptions) | ||
@@ -50,0 +51,0 @@ } |
@@ -10,6 +10,3 @@ module.exports = parseOptions | ||
'timeout', | ||
'host', | ||
'pathPrefix', | ||
'protocol', | ||
'port', | ||
'baseUrl', | ||
'agent', | ||
@@ -29,2 +26,18 @@ 'headers', | ||
if ('protocol' in userOptions) { | ||
console.warn('DEPRECATED: protocol option is no longer supported. All redirects are followed correctly') | ||
} | ||
if ('host' in userOptions) { | ||
console.warn('DEPRECATED: host option is no longer supported. All redirects are followed correctly') | ||
} | ||
if ('port' in userOptions) { | ||
console.warn('DEPRECATED: port option is no longer supported. All redirects are followed correctly') | ||
} | ||
if ('pathPrefix' in userOptions) { | ||
console.warn('DEPRECATED: pathPrefix option is no longer supported. All redirects are followed correctly') | ||
} | ||
if ('Promise' in userOptions) { | ||
@@ -37,2 +50,3 @@ console.warn('DEPRECATED: Promise option is no longer supported. The native Promise API is used') | ||
const clientDefaults = { | ||
baseUrl: options.baseUrl, | ||
headers: options.headers, | ||
@@ -43,15 +57,16 @@ request: { | ||
} | ||
if (userOptions.protocol) { | ||
clientDefaults.baseUrl = `${userOptions.protocol}://${userOptions.host}` | ||
clientDefaults.baseUrl = `${options.protocol}://${options.host}` | ||
if (userOptions.port) { | ||
clientDefaults.baseUrl += `:${userOptions.port}` | ||
} | ||
if (options.port) { | ||
clientDefaults.baseUrl += `:${options.port}` | ||
// Check if a prefix is passed in the options and strip any leading or trailing slashes from it. | ||
if (userOptions.pathPrefix) { | ||
clientDefaults.baseUrl += '/' + userOptions.pathPrefix.replace(/(^[/]+|[/]+$)/g, '') | ||
} | ||
} | ||
/* istanbul ignore else */ | ||
// Check if a prefix is passed in the options and strip any leading or trailing slashes from it. | ||
if (options.pathPrefix) { | ||
clientDefaults.baseUrl += '/' + options.pathPrefix.replace(/(^[/]+|[/]+$)/g, '') | ||
} | ||
/* istanbul ignore else */ | ||
if (!process.browser) { | ||
@@ -58,0 +73,0 @@ clientDefaults.request.agent = getRequestAgent(userOptions) |
{ | ||
"name": "@octokit/rest", | ||
"version": "15.1.9", | ||
"version": "15.2.0", | ||
"publishConfig": { | ||
@@ -88,3 +88,3 @@ "access": "public" | ||
"pretest": "standard && standard-markdown", | ||
"test": "nyc mocha test/mocha-node-setup.js 'test/**/*-test.js'", | ||
"test": "nyc mocha test/mocha-node-setup.js \"test/**/*-test.js\"", | ||
"test:browser": "cypress run --browser chrome", | ||
@@ -91,0 +91,0 @@ "test:examples": "node test/examples.js", |
@@ -66,7 +66,4 @@ # rest.js | ||
// change for custom GitHub Enterprise URL | ||
host: 'api.github.com', | ||
pathPrefix: '', | ||
protocol: 'https', | ||
port: 443, | ||
// custom GitHub Enterprise URL | ||
baseUrl: 'https://api.github.com', | ||
@@ -73,0 +70,0 @@ // Node only: advanced request options can be passed as http(s) agent |
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
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
563937
14726
231