@octokit/rest
Advanced tools
Comparing version 15.1.2 to 15.1.3
module.exports = getRequestAgent | ||
const pick = require('lodash/pick') | ||
const DEFAULTS = require('./defaults') | ||
const HttpAgent = require('http').Agent | ||
const HttpsAgent = require('https').Agent | ||
@@ -20,5 +21,12 @@ function getRequestAgent (options) { | ||
}) | ||
const Agent = require(options.protocol || DEFAULTS.protocol).Agent | ||
var Agent | ||
/* istanbul ignore if */ | ||
if (options.protocol && options.protocol === 'http') { | ||
Agent = HttpAgent | ||
} else { | ||
Agent = HttpsAgent | ||
} | ||
return new Agent(pick(options, agentOptions)) | ||
} |
@@ -11,3 +11,2 @@ 'use strict' | ||
const defaults = require('lodash/defaults') | ||
const isArrayBuffer = require('is-array-buffer') | ||
const isStream = require('is-stream') | ||
@@ -17,2 +16,3 @@ const pick = require('lodash/pick') | ||
const HttpError = require('./http-error') | ||
const isArrayBuffer = require('./is-array-buffer') | ||
@@ -19,0 +19,0 @@ function httpRequest (origRequestOptions) { |
{ | ||
"name": "@octokit/rest", | ||
"version": "15.1.2", | ||
"version": "15.1.3", | ||
"publishConfig": { | ||
@@ -42,3 +42,2 @@ "access": "public", | ||
"debug": "^3.1.0", | ||
"is-array-buffer": "^1.0.0", | ||
"is-stream": "^1.1.0", | ||
@@ -45,0 +44,0 @@ "lodash": "^4.17.4", |
@@ -51,3 +51,3 @@ # 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) | ||
### Options | ||
### Client options | ||
@@ -80,2 +80,30 @@ All available client options with default values | ||
## API Previews | ||
To take advantage of [GitHub’s API Previews](https://developer.github.com/v3/previews/), | ||
pass a custom `accept` header, which you can do with any endpoint method documented | ||
in the [API docs](https://octokit.github.io/rest.js/), e.g. | ||
```js | ||
const {data: {topics}} = octokit.repos.get({ | ||
owner: 'octokit', | ||
repo: 'rest.js', | ||
headers: { | ||
accept: 'application/vnd.github.mercy-preview+json' | ||
} | ||
}) | ||
``` | ||
Multiple preview headers can be combined by separating them with commas | ||
```js | ||
const {data: {topics, code_of_conduct}} = octokit.repos.get({ | ||
owner: 'octokit', | ||
repo: 'rest.js', | ||
headers: { | ||
accept: 'application/vnd.github.mercy-preview+json,application/vnd.github.scarlet-witch-preview+json' | ||
} | ||
}) | ||
``` | ||
## Authentication | ||
@@ -82,0 +110,0 @@ |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
566718
6
40
14804
233
1
5
- Removedis-array-buffer@^1.0.0
- Removedis-array-buffer@1.0.1(transitive)