Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKat Marchán <kzm@zkat.tech>2018-08-09 06:48:23 +0300
committerKat Marchán <kzm@zkat.tech>2018-08-09 06:49:55 +0300
commit866d776c27f80a71309389aaab42825b2a0916f6 (patch)
treeb4256e1f769f2245c982bae6a344a3fc8405a805 /node_modules/request
parent50df1bf691e205b9f13e0fff0d51a68772c40561 (diff)
request@2.87.0
Diffstat (limited to 'node_modules/request')
-rw-r--r--node_modules/request/CHANGELOG.md37
-rw-r--r--node_modules/request/README.md120
-rwxr-xr-xnode_modules/request/index.js27
-rw-r--r--node_modules/request/lib/auth.js11
-rw-r--r--node_modules/request/lib/cookies.js15
-rw-r--r--node_modules/request/lib/getProxyFromURI.js36
-rw-r--r--node_modules/request/lib/har.js20
-rw-r--r--node_modules/request/lib/hawk.js89
-rw-r--r--node_modules/request/lib/helpers.js20
-rw-r--r--node_modules/request/lib/multipart.js13
-rw-r--r--node_modules/request/lib/oauth.js44
-rw-r--r--node_modules/request/lib/querystring.js5
-rw-r--r--node_modules/request/lib/redirect.js17
-rw-r--r--node_modules/request/lib/tunnel.js51
-rw-r--r--node_modules/request/package.json58
-rw-r--r--node_modules/request/request.js223
16 files changed, 425 insertions, 361 deletions
diff --git a/node_modules/request/CHANGELOG.md b/node_modules/request/CHANGELOG.md
index af76719b4..751514d28 100644
--- a/node_modules/request/CHANGELOG.md
+++ b/node_modules/request/CHANGELOG.md
@@ -1,7 +1,41 @@
## Change Log
+### v2.87.0 (2018/05/21)
+- [#2943](https://github.com/request/request/pull/2943) Replace hawk dependency with a local implemenation (#2943) (@hueniverse)
+
+### v2.86.0 (2018/05/15)
+- [#2885](https://github.com/request/request/pull/2885) Remove redundant code (for Node.js 0.9.4 and below) and dependency (@ChALkeR)
+- [#2942](https://github.com/request/request/pull/2942) Make Test GREEN Again! (@simov)
+- [#2923](https://github.com/request/request/pull/2923) Alterations for failing CI tests (@gareth-robinson)
+
+### v2.85.0 (2018/03/12)
+- [#2880](https://github.com/request/request/pull/2880) Revert "Update hawk to 7.0.7 (#2880)" (@simov)
+
+### v2.84.0 (2018/03/12)
+- [#2793](https://github.com/request/request/pull/2793) Fixed calculation of oauth_body_hash, issue #2792 (@dvishniakov)
+- [#2880](https://github.com/request/request/pull/2880) Update hawk to 7.0.7 (#2880) (@kornel-kedzierski)
+
+### v2.83.0 (2017/09/27)
+- [#2776](https://github.com/request/request/pull/2776) Updating tough-cookie due to security fix. (#2776) (@karlnorling)
+
+### v2.82.0 (2017/09/19)
+- [#2703](https://github.com/request/request/pull/2703) Add Node.js v8 to Travis CI (@ryysud)
+- [#2751](https://github.com/request/request/pull/2751) Update of hawk and qs to latest version (#2751) (@Olivier-Moreau)
+- [#2658](https://github.com/request/request/pull/2658) Fixed some text in README.md (#2658) (@Marketionist)
+- [#2635](https://github.com/request/request/pull/2635) chore(package): update aws-sign2 to version 0.7.0 (#2635) (@greenkeeperio-bot)
+- [#2641](https://github.com/request/request/pull/2641) Update README to simplify & update convenience methods (#2641) (@FredKSchott)
+- [#2541](https://github.com/request/request/pull/2541) Add convenience method for HTTP OPTIONS (#2541) (@jamesseanwright)
+- [#2605](https://github.com/request/request/pull/2605) Add promise support section to README (#2605) (@FredKSchott)
+- [#2579](https://github.com/request/request/pull/2579) refactor(lint): replace eslint with standard (#2579) (@ahmadnassri)
+- [#2598](https://github.com/request/request/pull/2598) Update codecov to version 2.0.2 🚀 (@greenkeeperio-bot)
+- [#2590](https://github.com/request/request/pull/2590) Adds test-timing keepAlive test (@nicjansma)
+- [#2589](https://github.com/request/request/pull/2589) fix tabulation on request example README.MD (@odykyi)
+- [#2594](https://github.com/request/request/pull/2594) chore(dependencies): har-validator to 5.x [removes babel dep] (@ahmadnassri)
+
### v2.81.0 (2017/03/09)
- [#2584](https://github.com/request/request/pull/2584) Security issue: Upgrade qs to version 6.4.0 (@sergejmueller)
+- [#2578](https://github.com/request/request/pull/2578) safe-buffer doesn't zero-fill by default, its just a polyfill. (#2578) (@mikeal)
+- [#2566](https://github.com/request/request/pull/2566) Timings: Tracks 'lookup', adds 'wait' time, fixes connection re-use (#2566) (@nicjansma)
- [#2574](https://github.com/request/request/pull/2574) Migrating to safe-buffer for improved security. (@mikeal)
- [#2573](https://github.com/request/request/pull/2573) fixes #2572 (@ahmadnassri)
@@ -186,7 +220,8 @@
- [#1687](https://github.com/request/request/pull/1687) Fix caseless bug - content-type not being set for multipart/form-data (@simov, @garymathews)
### v2.59.0 (2015/07/20)
-- [#1671](https://github.com/request/request/pull/1671) Add tests and docs for using the agent, agentClass, agentOptions and forever options. Forever option defaults to using http(s).Agent in node 0.12+ (@simov)
+- [#1671](https://github.com/request/request/pull/1671) Add tests and docs for using the agent, agentClass, agentOptions and forever options.
+ Forever option defaults to using http(s).Agent in node 0.12+ (@simov)
- [#1679](https://github.com/request/request/pull/1679) Fix - do not remove OAuth param when using OAuth realm (@simov, @jhalickman)
- [#1668](https://github.com/request/request/pull/1668) updated dependencies (@deamme)
- [#1656](https://github.com/request/request/pull/1656) Fix form method (@simov)
diff --git a/node_modules/request/README.md b/node_modules/request/README.md
index 231739114..81ffd95ef 100644
--- a/node_modules/request/README.md
+++ b/node_modules/request/README.md
@@ -28,6 +28,7 @@ request('http://www.google.com', function (error, response, body) {
## Table of contents
- [Streaming](#streaming)
+- [Promises & Async/Await](#promises--asyncawait)
- [Forms](#forms)
- [HTTP Authentication](#http-authentication)
- [Custom HTTP Headers](#custom-http-headers)
@@ -142,6 +143,22 @@ You can still use intermediate proxies, the requests will still follow HTTP forw
---
+## Promises & Async/Await
+
+`request` supports both streaming and callback interfaces natively. If you'd like `request` to return a Promise instead, you can use an alternative interface wrapper for `request`. These wrappers can be useful if you prefer to work with Promises, or if you'd like to use `async`/`await` in ES2017.
+
+Several alternative interfaces are provided by the request team, including:
+- [`request-promise`](https://github.com/request/request-promise) (uses [Bluebird](https://github.com/petkaantonov/bluebird) Promises)
+- [`request-promise-native`](https://github.com/request/request-promise-native) (uses native Promises)
+- [`request-promise-any`](https://github.com/request/request-promise-any) (uses [any-promise](https://www.npmjs.com/package/any-promise) Promises)
+
+
+[back to top](#table-of-contents)
+
+
+---
+
+
## Forms
`request` supports `application/x-www-form-urlencoded` and `multipart/form-data` form uploads. For `multipart/related` refer to the `multipart` API.
@@ -170,7 +187,7 @@ var formData = {
// Pass a simple key-value pair
my_field: 'my_value',
// Pass data via Buffers
- my_buffer: new Buffer([1, 2, 3]),
+ my_buffer: Buffer.from([1, 2, 3]),
// Pass data via Streams
my_file: fs.createReadStream(__dirname + '/unicycle.jpg'),
// Pass multiple values /w an Array
@@ -204,7 +221,7 @@ For advanced cases, you can access the form-data object itself via `r.form()`. T
var r = request.post('http://service.com/upload', function optionalCallback(err, httpResponse, body) {...})
var form = r.form();
form.append('my_field', 'my_value');
-form.append('my_buffer', new Buffer([1, 2, 3]));
+form.append('my_buffer', Buffer.from([1, 2, 3]));
form.append('custom_file', fs.createReadStream(__dirname + '/unicycle.jpg'), {filename: 'unicycle.jpg'});
```
See the [form-data README](https://github.com/form-data/form-data) for more information & examples.
@@ -608,7 +625,7 @@ request.get(options);
### Using `options.agentOptions`
-In the example below, we call an API requires client side SSL certificate
+In the example below, we call an API that requires client side SSL certificate
(in PEM format) with passphrase protected private key (in PEM format) and disable the SSLv3 protocol:
```js
@@ -667,7 +684,7 @@ request.get({
The `options.har` property will override the values: `url`, `method`, `qs`, `headers`, `form`, `formData`, `body`, `json`, as well as construct multipart data and read files from disk when `request.postData.params[].fileName` is present without a matching `value`.
-a validation step will check if the HAR Request format matches the latest spec (v1.2) and will skip parsing if not matching.
+A validation step will check if the HAR Request format matches the latest spec (v1.2) and will skip parsing if not matching.
```js
var request = require('request')
@@ -726,7 +743,7 @@ The first argument can be either a `url` or an `options` object. The only requir
- `qs` - object containing querystring values to be appended to the `uri`
- `qsParseOptions` - object containing options to pass to the [qs.parse](https://github.com/hapijs/qs#parsing-objects) method. Alternatively pass options to the [querystring.parse](https://nodejs.org/docs/v0.12.0/api/querystring.html#querystring_querystring_parse_str_sep_eq_options) method using this format `{sep:';', eq:':', options:{}}`
- `qsStringifyOptions` - object containing options to pass to the [qs.stringify](https://github.com/hapijs/qs#stringifying) method. Alternatively pass options to the [querystring.stringify](https://nodejs.org/docs/v0.12.0/api/querystring.html#querystring_querystring_stringify_obj_sep_eq_options) method using this format `{sep:';', eq:':', options:{}}`. For example, to change the way arrays are converted to query strings using the `qs` module pass the `arrayFormat` option with one of `indices|brackets|repeat`
-- `useQuerystring` - If true, use `querystring` to stringify and parse
+- `useQuerystring` - if true, use `querystring` to stringify and parse
querystrings, otherwise use `qs` (default: `false`). Set this option to
`true` if you need arrays to be serialized as `foo=bar&foo=baz` instead of the
default `foo[0]=bar&foo[1]=baz`.
@@ -735,7 +752,7 @@ The first argument can be either a `url` or an `options` object. The only requir
- `body` - entity body for PATCH, POST and PUT requests. Must be a `Buffer`, `String` or `ReadStream`. If `json` is `true`, then `body` must be a JSON-serializable object.
- `form` - when passed an object or a querystring, this sets `body` to a querystring representation of value, and adds `Content-type: application/x-www-form-urlencoded` header. When passed no options, a `FormData` instance is returned (and is piped to request). See "Forms" section above.
-- `formData` - Data to pass for a `multipart/form-data` request. See
+- `formData` - data to pass for a `multipart/form-data` request. See
[Forms](#forms) section above.
- `multipart` - array of objects which contain their own headers and `body`
attributes. Sends a `multipart/related` request. See [Forms](#forms) section
@@ -752,11 +769,11 @@ The first argument can be either a `url` or an `options` object. The only requir
---
-- `auth` - A hash containing values `user` || `username`, `pass` || `password`, and `sendImmediately` (optional). See documentation above.
-- `oauth` - Options for OAuth HMAC-SHA1 signing. See documentation above.
-- `hawk` - Options for [Hawk signing](https://github.com/hueniverse/hawk). The `credentials` key must contain the necessary signing info, [see hawk docs for details](https://github.com/hueniverse/hawk#usage-example).
+- `auth` - a hash containing values `user` || `username`, `pass` || `password`, and `sendImmediately` (optional). See documentation above.
+- `oauth` - options for OAuth HMAC-SHA1 signing. See documentation above.
+- `hawk` - options for [Hawk signing](https://github.com/hueniverse/hawk). The `credentials` key must contain the necessary signing info, [see hawk docs for details](https://github.com/hueniverse/hawk#usage-example).
- `aws` - `object` containing AWS signing information. Should have the properties `key`, `secret`, and optionally `session` (note that this only works for services that require session as part of the canonical string). Also requires the property `bucket`, unless you’re specifying your `bucket` as part of the path, or the request doesn’t use a bucket (i.e. GET Services). If you want to use AWS sign version 4 use the parameter `sign_version` with value `4` otherwise the default is version 2. **Note:** you need to `npm install aws4` first.
-- `httpSignature` - Options for the [HTTP Signature Scheme](https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](https://github.com/joyent/node-http-signature). The `keyId` and `key` properties must be specified. See the docs for other options.
+- `httpSignature` - options for the [HTTP Signature Scheme](https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](https://github.com/joyent/node-http-signature). The `keyId` and `key` properties must be specified. See the docs for other options.
---
@@ -768,9 +785,9 @@ The first argument can be either a `url` or an `options` object. The only requir
---
-- `encoding` - Encoding to be used on `setEncoding` of response data. If `null`, the `body` is returned as a `Buffer`. Anything else **(including the default value of `undefined`)** will be passed as the [encoding](http://nodejs.org/api/buffer.html#buffer_buffer) parameter to `toString()` (meaning this is effectively `utf8` by default). (**Note:** if you expect binary data, you should set `encoding: null`.)
-- `gzip` - If `true`, add an `Accept-Encoding` header to request compressed content encodings from the server (if not already present) and decode supported content encodings in the response. **Note:** Automatic decoding of the response content is performed on the body data returned through `request` (both through the `request` stream and passed to the callback function) but is not performed on the `response` stream (available from the `response` event) which is the unmodified `http.IncomingMessage` object which may contain compressed data. See example below.
-- `jar` - If `true`, remember cookies for future use (or define your custom cookie jar; see examples section)
+- `encoding` - encoding to be used on `setEncoding` of response data. If `null`, the `body` is returned as a `Buffer`. Anything else **(including the default value of `undefined`)** will be passed as the [encoding](http://nodejs.org/api/buffer.html#buffer_buffer) parameter to `toString()` (meaning this is effectively `utf8` by default). (**Note:** if you expect binary data, you should set `encoding: null`.)
+- `gzip` - if `true`, add an `Accept-Encoding` header to request compressed content encodings from the server (if not already present) and decode supported content encodings in the response. **Note:** Automatic decoding of the response content is performed on the body data returned through `request` (both through the `request` stream and passed to the callback function) but is not performed on the `response` stream (available from the `response` event) which is the unmodified `http.IncomingMessage` object which may contain compressed data. See example below.
+- `jar` - if `true`, remember cookies for future use (or define your custom cookie jar; see examples section)
---
@@ -778,14 +795,14 @@ The first argument can be either a `url` or an `options` object. The only requir
- `agentClass` - alternatively specify your agent's class name
- `agentOptions` - and pass its options. **Note:** for HTTPS see [tls API doc for TLS/SSL options](http://nodejs.org/api/tls.html#tls_tls_connect_options_callback) and the [documentation above](#using-optionsagentoptions).
- `forever` - set to `true` to use the [forever-agent](https://github.com/request/forever-agent) **Note:** Defaults to `http(s).Agent({keepAlive:true})` in node 0.12+
-- `pool` - An object describing which agents to use for the request. If this option is omitted the request will use the global agent (as long as your options allow for it). Otherwise, request will search the pool for your custom agent. If no custom agent is found, a new agent will be created and added to the pool. **Note:** `pool` is used only when the `agent` option is not specified.
+- `pool` - an object describing which agents to use for the request. If this option is omitted the request will use the global agent (as long as your options allow for it). Otherwise, request will search the pool for your custom agent. If no custom agent is found, a new agent will be created and added to the pool. **Note:** `pool` is used only when the `agent` option is not specified.
- A `maxSockets` property can also be provided on the `pool` object to set the max number of sockets for all agents created (ex: `pool: {maxSockets: Infinity}`).
- Note that if you are sending multiple requests in a loop and creating
multiple new `pool` objects, `maxSockets` will not work as intended. To
work around this, either use [`request.defaults`](#requestdefaultsoptions)
with your pool options or create the pool object with the `maxSockets`
property outside of the loop.
-- `timeout` - Integer containing the number of milliseconds to wait for a
+- `timeout` - integer containing the number of milliseconds to wait for a
server to send response headers (and start the response body) before aborting
the request. Note that if the underlying TCP connection cannot be established,
the OS-wide TCP connection timeout will overrule the `timeout` option ([the
@@ -795,9 +812,9 @@ default in Linux can be anywhere from 20-120 seconds][linux-timeout]).
---
-- `localAddress` - Local interface to bind for network connections.
-- `proxy` - An HTTP proxy to be used. Supports proxy Auth with Basic Auth, identical to support for the `url` parameter (by embedding the auth info in the `uri`)
-- `strictSSL` - If `true`, requires SSL certificates be valid. **Note:** to use your own certificate authority, you need to specify an agent that was created with that CA as an option.
+- `localAddress` - local interface to bind for network connections.
+- `proxy` - an HTTP proxy to be used. Supports proxy Auth with Basic Auth, identical to support for the `url` parameter (by embedding the auth info in the `uri`)
+- `strictSSL` - if `true`, requires SSL certificates be valid. **Note:** to use your own certificate authority, you need to specify an agent that was created with that CA as an option.
- `tunnel` - controls the behavior of
[HTTP `CONNECT` tunneling](https://en.wikipedia.org/wiki/HTTP_tunnel#HTTP_CONNECT_tunneling)
as follows:
@@ -805,14 +822,14 @@ default in Linux can be anywhere from 20-120 seconds][linux-timeout]).
- `true` - always tunnel to the destination by making a `CONNECT` request to
the proxy
- `false` - request the destination as a `GET` request.
-- `proxyHeaderWhiteList` - A whitelist of headers to send to a
+- `proxyHeaderWhiteList` - a whitelist of headers to send to a
tunneling proxy.
-- `proxyHeaderExclusiveList` - A whitelist of headers to send
+- `proxyHeaderExclusiveList` - a whitelist of headers to send
exclusively to a tunneling proxy and not to destination.
---
-- `time` - If `true`, the request-response cycle (including all redirects) is timed at millisecond resolution. When set, the following properties are added to the response object:
+- `time` - if `true`, the request-response cycle (including all redirects) is timed at millisecond resolution. When set, the following properties are added to the response object:
- `elapsedTime` Duration of the entire request/response in milliseconds (*deprecated*).
- `responseStartTime` Timestamp when the response began (in Unix Epoch milliseconds) (*deprecated*).
- `timingStart` Timestamp of the start of the request (in Unix Epoch milliseconds).
@@ -830,7 +847,7 @@ default in Linux can be anywhere from 20-120 seconds][linux-timeout]).
- `download`: Duration of HTTP download (`timings.end` - `timings.response`)
- `total`: Duration entire HTTP round-trip (`timings.end`)
-- `har` - A [HAR 1.2 Request Object](http://www.softwareishard.com/blog/har-12-spec/#request), will be processed from HAR format into options overwriting matching values *(see the [HAR 1.2 section](#support-for-har-1.2) for details)*
+- `har` - a [HAR 1.2 Request Object](http://www.softwareishard.com/blog/har-12-spec/#request), will be processed from HAR format into options overwriting matching values *(see the [HAR 1.2 section](#support-for-har-1.2) for details)*
- `callback` - alternatively pass the request's callback in the options object
The callback argument gets 3 arguments:
@@ -874,55 +891,19 @@ var specialRequest = baseRequest.defaults({
})
```
-### request.put
+### request.METHOD()
-Same as `request()`, but defaults to `method: "PUT"`.
+These HTTP method convenience functions act just like `request()` but with a default method already set for you:
-```js
-request.put(url)
-```
-
-### request.patch
+- *request.get()*: Defaults to `method: "GET"`.
+- *request.post()*: Defaults to `method: "POST"`.
+- *request.put()*: Defaults to `method: "PUT"`.
+- *request.patch()*: Defaults to `method: "PATCH"`.
+- *request.del() / request.delete()*: Defaults to `method: "DELETE"`.
+- *request.head()*: Defaults to `method: "HEAD"`.
+- *request.options()*: Defaults to `method: "OPTIONS"`.
-Same as `request()`, but defaults to `method: "PATCH"`.
-
-```js
-request.patch(url)
-```
-
-### request.post
-
-Same as `request()`, but defaults to `method: "POST"`.
-
-```js
-request.post(url)
-```
-
-### request.head
-
-Same as `request()`, but defaults to `method: "HEAD"`.
-
-```js
-request.head(url)
-```
-
-### request.del / request.delete
-
-Same as `request()`, but defaults to `method: "DELETE"`.
-
-```js
-request.del(url)
-request.delete(url)
-```
-
-### request.get
-
-Same as `request()` (for uniformity).
-
-```js
-request.get(url)
-```
-### request.cookie
+### request.cookie()
Function that creates a new cookie.
@@ -1036,7 +1017,8 @@ the server sent a compressed response.
console.log('server encoded the data as: ' + (response.headers['content-encoding'] || 'identity'))
console.log('the decoded data is: ' + body)
}
- ).on('data', function(data) {
+ )
+ .on('data', function(data) {
// decompressed data as it is received
console.log('decoded chunk: ' + data)
})
diff --git a/node_modules/request/index.js b/node_modules/request/index.js
index 9ec65ea26..f9b480a1d 100755
--- a/node_modules/request/index.js
+++ b/node_modules/request/index.js
@@ -14,15 +14,14 @@
'use strict'
-var extend = require('extend')
- , cookies = require('./lib/cookies')
- , helpers = require('./lib/helpers')
+var extend = require('extend')
+var cookies = require('./lib/cookies')
+var helpers = require('./lib/helpers')
var paramsHaveRequestBody = helpers.paramsHaveRequestBody
-
// organize params for patch, post, put, head, del
-function initParams(uri, options, callback) {
+function initParams (uri, options, callback) {
if (typeof options === 'function') {
callback = options
}
@@ -66,6 +65,7 @@ function verbFunc (verb) {
// define like this to please codeintel/intellisense IDEs
request.get = verbFunc('get')
request.head = verbFunc('head')
+request.options = verbFunc('options')
request.post = verbFunc('post')
request.put = verbFunc('put')
request.patch = verbFunc('patch')
@@ -81,7 +81,6 @@ request.cookie = function (str) {
}
function wrapRequestMethod (method, options, requester, verb) {
-
return function (uri, opts, callback) {
var params = initParams(uri, opts, callback)
@@ -112,15 +111,15 @@ request.defaults = function (options, requester) {
options = {}
}
- var defaults = wrapRequestMethod(self, options, requester)
+ var defaults = wrapRequestMethod(self, options, requester)
var verbs = ['get', 'head', 'post', 'put', 'patch', 'del', 'delete']
- verbs.forEach(function(verb) {
- defaults[verb] = wrapRequestMethod(self[verb], options, requester, verb)
+ verbs.forEach(function (verb) {
+ defaults[verb] = wrapRequestMethod(self[verb], options, requester, verb)
})
- defaults.cookie = wrapRequestMethod(self.cookie, options, requester)
- defaults.jar = self.jar
+ defaults.cookie = wrapRequestMethod(self.cookie, options, requester)
+ defaults.jar = self.jar
defaults.defaults = self.defaults
return defaults
}
@@ -146,11 +145,11 @@ request.initParams = initParams
// Backwards compatibility for request.debug
Object.defineProperty(request, 'debug', {
- enumerable : true,
- get : function() {
+ enumerable: true,
+ get: function () {
return request.Request.debug
},
- set : function(debug) {
+ set: function (debug) {
request.Request.debug = debug
}
})
diff --git a/node_modules/request/lib/auth.js b/node_modules/request/lib/auth.js
index 559ca57be..42f9adaec 100644
--- a/node_modules/request/lib/auth.js
+++ b/node_modules/request/lib/auth.js
@@ -1,12 +1,11 @@
'use strict'
var caseless = require('caseless')
- , uuid = require('uuid')
- , helpers = require('./helpers')
+var uuid = require('uuid')
+var helpers = require('./helpers')
var md5 = helpers.md5
- , toBase64 = helpers.toBase64
-
+var toBase64 = helpers.toBase64
function Auth (request) {
// define all public properties here
@@ -126,7 +125,7 @@ Auth.prototype.digest = function (method, path, authHeader) {
Auth.prototype.onRequest = function (user, pass, sendImmediately, bearer) {
var self = this
- , request = self.request
+ var request = self.request
var authHeader
if (bearer === undefined && user === undefined) {
@@ -143,7 +142,7 @@ Auth.prototype.onRequest = function (user, pass, sendImmediately, bearer) {
Auth.prototype.onResponse = function (response) {
var self = this
- , request = self.request
+ var request = self.request
if (!self.hasAuth || self.sentAuth) { return null }
diff --git a/node_modules/request/lib/cookies.js b/node_modules/request/lib/cookies.js
index 412c07d63..bd5d46bea 100644
--- a/node_modules/request/lib/cookies.js
+++ b/node_modules/request/lib/cookies.js
@@ -3,10 +3,9 @@
var tough = require('tough-cookie')
var Cookie = tough.Cookie
- , CookieJar = tough.CookieJar
+var CookieJar = tough.CookieJar
-
-exports.parse = function(str) {
+exports.parse = function (str) {
if (str && str.uri) {
str = str.uri
}
@@ -17,23 +16,23 @@ exports.parse = function(str) {
}
// Adapt the sometimes-Async api of tough.CookieJar to our requirements
-function RequestJar(store) {
+function RequestJar (store) {
var self = this
self._jar = new CookieJar(store, {looseMode: true})
}
-RequestJar.prototype.setCookie = function(cookieOrStr, uri, options) {
+RequestJar.prototype.setCookie = function (cookieOrStr, uri, options) {
var self = this
return self._jar.setCookieSync(cookieOrStr, uri, options || {})
}
-RequestJar.prototype.getCookieString = function(uri) {
+RequestJar.prototype.getCookieString = function (uri) {
var self = this
return self._jar.getCookieStringSync(uri)
}
-RequestJar.prototype.getCookies = function(uri) {
+RequestJar.prototype.getCookies = function (uri) {
var self = this
return self._jar.getCookiesSync(uri)
}
-exports.jar = function(store) {
+exports.jar = function (store) {
return new RequestJar(store)
}
diff --git a/node_modules/request/lib/getProxyFromURI.js b/node_modules/request/lib/getProxyFromURI.js
index c2013a6e1..4633ba5f6 100644
--- a/node_modules/request/lib/getProxyFromURI.js
+++ b/node_modules/request/lib/getProxyFromURI.js
@@ -1,33 +1,33 @@
'use strict'
-function formatHostname(hostname) {
+function formatHostname (hostname) {
// canonicalize the hostname, so that 'oogle.com' won't match 'google.com'
return hostname.replace(/^\.*/, '.').toLowerCase()
}
-function parseNoProxyZone(zone) {
+function parseNoProxyZone (zone) {
zone = zone.trim().toLowerCase()
var zoneParts = zone.split(':', 2)
- , zoneHost = formatHostname(zoneParts[0])
- , zonePort = zoneParts[1]
- , hasPort = zone.indexOf(':') > -1
+ var zoneHost = formatHostname(zoneParts[0])
+ var zonePort = zoneParts[1]
+ var hasPort = zone.indexOf(':') > -1
return {hostname: zoneHost, port: zonePort, hasPort: hasPort}
}
-function uriInNoProxy(uri, noProxy) {
+function uriInNoProxy (uri, noProxy) {
var port = uri.port || (uri.protocol === 'https:' ? '443' : '80')
- , hostname = formatHostname(uri.hostname)
- , noProxyList = noProxy.split(',')
+ var hostname = formatHostname(uri.hostname)
+ var noProxyList = noProxy.split(',')
// iterate through the noProxyList until it finds a match.
- return noProxyList.map(parseNoProxyZone).some(function(noProxyZone) {
+ return noProxyList.map(parseNoProxyZone).some(function (noProxyZone) {
var isMatchedAt = hostname.indexOf(noProxyZone.hostname)
- , hostnameMatched = (
- isMatchedAt > -1 &&
- (isMatchedAt === hostname.length - noProxyZone.hostname.length)
- )
+ var hostnameMatched = (
+ isMatchedAt > -1 &&
+ (isMatchedAt === hostname.length - noProxyZone.hostname.length)
+ )
if (noProxyZone.hasPort) {
return (port === noProxyZone.port) && hostnameMatched
@@ -37,7 +37,7 @@ function uriInNoProxy(uri, noProxy) {
})
}
-function getProxyFromURI(uri) {
+function getProxyFromURI (uri) {
// Decide the proper request proxy to use based on the request URI object and the
// environmental variables (NO_PROXY, HTTP_PROXY, etc.)
// respect NO_PROXY environment variables (see: http://lynx.isc.org/current/breakout/lynx_help/keystrokes/environments.html)
@@ -60,14 +60,14 @@ function getProxyFromURI(uri) {
if (uri.protocol === 'http:') {
return process.env.HTTP_PROXY ||
- process.env.http_proxy || null
+ process.env.http_proxy || null
}
if (uri.protocol === 'https:') {
return process.env.HTTPS_PROXY ||
- process.env.https_proxy ||
- process.env.HTTP_PROXY ||
- process.env.http_proxy || null
+ process.env.https_proxy ||
+ process.env.HTTP_PROXY ||
+ process.env.http_proxy || null
}
// if none of that works, return null
diff --git a/node_modules/request/lib/har.js b/node_modules/request/lib/har.js
index 305957487..2f660309d 100644
--- a/node_modules/request/lib/har.js
+++ b/node_modules/request/lib/har.js
@@ -71,14 +71,10 @@ Har.prototype.prep = function (data) {
'multipart/related',
'multipart/form-data',
'multipart/alternative'])) {
-
// reset values
data.postData.mimeType = 'multipart/form-data'
- }
-
- else if (some([
+ } else if (some([
'application/x-www-form-urlencoded'])) {
-
if (!data.postData.params) {
data.postData.text = ''
} else {
@@ -87,14 +83,11 @@ Har.prototype.prep = function (data) {
// always overwrite
data.postData.text = qs.stringify(data.postData.paramsObj)
}
- }
-
- else if (some([
+ } else if (some([
'text/json',
'text/x-json',
'application/json',
'application/x-json'])) {
-
data.postData.mimeType = 'application/json'
if (data.postData.text) {
@@ -168,14 +161,12 @@ Har.prototype.options = function (options) {
}
if (test('application/x-www-form-urlencoded')) {
options.form = req.postData.paramsObj
- }
- else if (test('application/json')) {
+ } else if (test('application/json')) {
if (req.postData.jsonObj) {
options.body = req.postData.jsonObj
options.json = true
}
- }
- else if (test('multipart/form-data')) {
+ } else if (test('multipart/form-data')) {
options.formData = {}
req.postData.params.forEach(function (param) {
@@ -202,8 +193,7 @@ Har.prototype.options = function (options) {
options.formData[param.name] = attachment
})
- }
- else {
+ } else {
if (req.postData.text) {
options.body = req.postData.text
}
diff --git a/node_modules/request/lib/hawk.js b/node_modules/request/lib/hawk.js
new file mode 100644
index 000000000..de48a9851
--- /dev/null
+++ b/node_modules/request/lib/hawk.js
@@ -0,0 +1,89 @@
+'use strict'
+
+var crypto = require('crypto')
+
+function randomString (size) {
+ var bits = (size + 1) * 6
+ var buffer = crypto.randomBytes(Math.ceil(bits / 8))
+ var string = buffer.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '')
+ return string.slice(0, size)
+}
+
+function calculatePayloadHash (payload, algorithm, contentType) {
+ var hash = crypto.createHash(algorithm)
+ hash.update('hawk.1.payload\n')
+ hash.update((contentType ? contentType.split(';')[0].trim().toLowerCase() : '') + '\n')
+ hash.update(payload || '')
+ hash.update('\n')
+ return hash.digest('base64')
+}
+
+exports.calculateMac = function (credentials, opts) {
+ var normalized = 'hawk.1.header\n' +
+ opts.ts + '\n' +
+ opts.nonce + '\n' +
+ (opts.method || '').toUpperCase() + '\n' +
+ opts.resource + '\n' +
+ opts.host.toLowerCase() + '\n' +
+ opts.port + '\n' +
+ (opts.hash || '') + '\n'
+
+ if (opts.ext) {
+ normalized = normalized + opts.ext.replace('\\', '\\\\').replace('\n', '\\n')
+ }
+
+ normalized = normalized + '\n'
+
+ if (opts.app) {
+ normalized = normalized + opts.app + '\n' + (opts.dlg || '') + '\n'
+ }
+
+ var hmac = crypto.createHmac(credentials.algorithm, credentials.key).update(normalized)
+ var digest = hmac.digest('base64')
+ return digest
+}
+
+exports.header = function (uri, method, opts) {
+ var timestamp = opts.timestamp || Math.floor((Date.now() + (opts.localtimeOffsetMsec || 0)) / 1000)
+ var credentials = opts.credentials
+ if (!credentials || !credentials.id || !credentials.key || !credentials.algorithm) {
+ return ''
+ }
+
+ if (['sha1', 'sha256'].indexOf(credentials.algorithm) === -1) {
+ return ''
+ }
+
+ var artifacts = {
+ ts: timestamp,
+ nonce: opts.nonce || randomString(6),
+ method: method,
+ resource: uri.pathname + (uri.search || ''),
+ host: uri.hostname,
+ port: uri.port || (uri.protocol === 'http:' ? 80 : 443),
+ hash: opts.hash,
+ ext: opts.ext,
+ app: opts.app,
+ dlg: opts.dlg
+ }
+
+ if (!artifacts.hash && (opts.payload || opts.payload === '')) {
+ artifacts.hash = calculatePayloadHash(opts.payload, credentials.algorithm, opts.contentType)
+ }
+
+ var mac = exports.calculateMac(credentials, artifacts)
+
+ var hasExt = artifacts.ext !== null && artifacts.ext !== undefined && artifacts.ext !== ''
+ var header = 'Hawk id="' + credentials.id +
+ '", ts="' + artifacts.ts +
+ '", nonce="' + artifacts.nonce +
+ (artifacts.hash ? '", hash="' + artifacts.hash : '') +
+ (hasExt ? '", ext="' + artifacts.ext.replace(/\\/g, '\\\\').replace(/"/g, '\\"') : '') +
+ '", mac="' + mac + '"'
+
+ if (artifacts.app) {
+ header = header + ', app="' + artifacts.app + (artifacts.dlg ? '", dlg="' + artifacts.dlg : '') + '"'
+ }
+
+ return header
+}
diff --git a/node_modules/request/lib/helpers.js b/node_modules/request/lib/helpers.js
index 05c77a0bd..8b2a7e6eb 100644
--- a/node_modules/request/lib/helpers.js
+++ b/node_modules/request/lib/helpers.js
@@ -1,14 +1,14 @@
'use strict'
var jsonSafeStringify = require('json-stringify-safe')
- , crypto = require('crypto')
- , Buffer = require('safe-buffer').Buffer
+var crypto = require('crypto')
+var Buffer = require('safe-buffer').Buffer
var defer = typeof setImmediate === 'undefined'
? process.nextTick
: setImmediate
-function paramsHaveRequestBody(params) {
+function paramsHaveRequestBody (params) {
return (
params.body ||
params.requestBodyStream ||
@@ -57,10 +57,10 @@ function version () {
}
exports.paramsHaveRequestBody = paramsHaveRequestBody
-exports.safeStringify = safeStringify
-exports.md5 = md5
-exports.isReadStream = isReadStream
-exports.toBase64 = toBase64
-exports.copy = copy
-exports.version = version
-exports.defer = defer
+exports.safeStringify = safeStringify
+exports.md5 = md5
+exports.isReadStream = isReadStream
+exports.toBase64 = toBase64
+exports.copy = copy
+exports.version = version
+exports.defer = defer
diff --git a/node_modules/request/lib/multipart.js b/node_modules/request/lib/multipart.js
index fc7b50276..d6b981277 100644
--- a/node_modules/request/lib/multipart.js
+++ b/node_modules/request/lib/multipart.js
@@ -1,10 +1,9 @@
'use strict'
var uuid = require('uuid')
- , CombinedStream = require('combined-stream')
- , isstream = require('isstream')
- , Buffer = require('safe-buffer').Buffer
-
+var CombinedStream = require('combined-stream')
+var isstream = require('isstream')
+var Buffer = require('safe-buffer').Buffer
function Multipart (request) {
this.request = request
@@ -15,8 +14,8 @@ function Multipart (request) {
Multipart.prototype.isChunked = function (options) {
var self = this
- , chunked = false
- , parts = options.data || options
+ var chunked = false
+ var parts = options.data || options
if (!parts.forEach) {
self.request.emit('error', new Error('Argument error, options.multipart.'))
@@ -103,7 +102,7 @@ Multipart.prototype.onRequest = function (options) {
var self = this
var chunked = self.isChunked(options)
- , parts = options.data || options
+ var parts = options.data || options
self.setHeaders(chunked)
self.chunked = chunked
diff --git a/node_modules/request/lib/oauth.js b/node_modules/request/lib/oauth.js
index 13b693773..01c626282 100644
--- a/node_modules/request/lib/oauth.js
+++ b/node_modules/request/lib/oauth.js
@@ -1,13 +1,12 @@
'use strict'
var url = require('url')
- , qs = require('qs')
- , caseless = require('caseless')
- , uuid = require('uuid')
- , oauth = require('oauth-sign')
- , crypto = require('crypto')
- , Buffer = require('safe-buffer').Buffer
-
+var qs = require('qs')
+var caseless = require('caseless')
+var uuid = require('uuid')
+var oauth = require('oauth-sign')
+var crypto = require('crypto')
+var Buffer = require('safe-buffer').Buffer
function OAuth (request) {
this.request = request
@@ -23,7 +22,7 @@ OAuth.prototype.buildParams = function (_oauth, uri, method, query, form, qsLib)
oa.oauth_version = '1.0'
}
if (!oa.oauth_timestamp) {
- oa.oauth_timestamp = Math.floor( Date.now() / 1000 ).toString()
+ oa.oauth_timestamp = Math.floor(Date.now() / 1000).toString()
}
if (!oa.oauth_nonce) {
oa.oauth_nonce = uuid().replace(/-/g, '')
@@ -32,11 +31,11 @@ OAuth.prototype.buildParams = function (_oauth, uri, method, query, form, qsLib)
oa.oauth_signature_method = 'HMAC-SHA1'
}
- var consumer_secret_or_private_key = oa.oauth_consumer_secret || oa.oauth_private_key
+ var consumer_secret_or_private_key = oa.oauth_consumer_secret || oa.oauth_private_key // eslint-disable-line camelcase
delete oa.oauth_consumer_secret
delete oa.oauth_private_key
- var token_secret = oa.oauth_token_secret
+ var token_secret = oa.oauth_token_secret // eslint-disable-line camelcase
delete oa.oauth_token_secret
var realm = oa.oauth_realm
@@ -51,8 +50,9 @@ OAuth.prototype.buildParams = function (_oauth, uri, method, query, form, qsLib)
method,
baseurl,
params,
- consumer_secret_or_private_key,
- token_secret)
+ consumer_secret_or_private_key, // eslint-disable-line camelcase
+ token_secret // eslint-disable-line camelcase
+ )
if (realm) {
oa.realm = realm
@@ -61,7 +61,7 @@ OAuth.prototype.buildParams = function (_oauth, uri, method, query, form, qsLib)
return oa
}
-OAuth.prototype.buildBodyHash = function(_oauth, body) {
+OAuth.prototype.buildBodyHash = function (_oauth, body) {
if (['HMAC-SHA1', 'RSA-SHA1'].indexOf(_oauth.signature_method || 'HMAC-SHA1') < 0) {
this.request.emit('error', new Error('oauth: ' + _oauth.signature_method +
' signature_method not supported with body_hash signing.'))
@@ -71,7 +71,7 @@ OAuth.prototype.buildBodyHash = function(_oauth, body) {
shasum.update(body || '')
var sha1 = shasum.digest('hex')
- return Buffer.from(sha1).toString('base64')
+ return Buffer.from(sha1, 'hex').toString('base64')
}
OAuth.prototype.concatParams = function (oa, sep, wrap) {
@@ -96,16 +96,16 @@ OAuth.prototype.onRequest = function (_oauth) {
self.params = _oauth
var uri = self.request.uri || {}
- , method = self.request.method || ''
- , headers = caseless(self.request.headers)
- , body = self.request.body || ''
- , qsLib = self.request.qsLib || qs
+ var method = self.request.method || ''
+ var headers = caseless(self.request.headers)
+ var body = self.request.body || ''
+ var qsLib = self.request.qsLib || qs
var form
- , query
- , contentType = headers.get('content-type') || ''
- , formContentType = 'application/x-www-form-urlencoded'
- , transport = _oauth.transport_method || 'header'
+ var query
+ var contentType = headers.get('content-type') || ''
+ var formContentType = 'application/x-www-form-urlencoded'
+ var transport = _oauth.transport_method || 'header'
if (contentType.slice(0, formContentType.length) === formContentType) {
contentType = formContentType
diff --git a/node_modules/request/lib/querystring.js b/node_modules/request/lib/querystring.js
index baf5e8021..4a32cd149 100644
--- a/node_modules/request/lib/querystring.js
+++ b/node_modules/request/lib/querystring.js
@@ -1,8 +1,7 @@
'use strict'
var qs = require('qs')
- , querystring = require('querystring')
-
+var querystring = require('querystring')
function Querystring (request) {
this.request = request
@@ -13,7 +12,7 @@ function Querystring (request) {
}
Querystring.prototype.init = function (options) {
- if (this.lib) {return}
+ if (this.lib) { return }
this.useQuerystring = options.useQuerystring
this.lib = (this.useQuerystring ? querystring : qs)
diff --git a/node_modules/request/lib/redirect.js b/node_modules/request/lib/redirect.js
index f8604491f..b9150e77c 100644
--- a/node_modules/request/lib/redirect.js
+++ b/node_modules/request/lib/redirect.js
@@ -9,7 +9,7 @@ function Redirect (request) {
this.followRedirects = true
this.followAllRedirects = false
this.followOriginalHttpMethod = false
- this.allowRedirect = function () {return true}
+ this.allowRedirect = function () { return true }
this.maxRedirects = 10
this.redirects = []
this.redirectsFollowed = 0
@@ -44,7 +44,7 @@ Redirect.prototype.onRequest = function (options) {
Redirect.prototype.redirectTo = function (response) {
var self = this
- , request = self.request
+ var request = self.request
var redirectTo = null
if (response.statusCode >= 300 && response.statusCode < 400 && response.caseless.has('location')) {
@@ -78,7 +78,7 @@ Redirect.prototype.redirectTo = function (response) {
Redirect.prototype.onResponse = function (response) {
var self = this
- , request = self.request
+ var request = self.request
var redirectTo = self.redirectTo(response)
if (!redirectTo || !self.allowRedirect.call(request, response)) {
@@ -112,13 +112,10 @@ Redirect.prototype.onResponse = function (response) {
delete request.agent
}
- self.redirects.push(
- { statusCode : response.statusCode
- , redirectUri: redirectTo
- }
- )
- if (self.followAllRedirects && request.method !== 'HEAD'
- && response.statusCode !== 401 && response.statusCode !== 307) {
+ self.redirects.push({ statusCode: response.statusCode, redirectUri: redirectTo })
+
+ if (self.followAllRedirects && request.method !== 'HEAD' &&
+ response.statusCode !== 401 && response.statusCode !== 307) {
request.method = self.followOriginalHttpMethod ? request.method : 'GET'
}
// request.method = 'GET' // Force all redirects to use GET || commented out fixes #215
diff --git a/node_modules/request/lib/tunnel.js b/node_modules/request/lib/tunnel.js
index bf96a8fec..4479003f6 100644
--- a/node_modules/request/lib/tunnel.js
+++ b/node_modules/request/lib/tunnel.js
@@ -1,7 +1,7 @@
'use strict'
var url = require('url')
- , tunnel = require('tunnel-agent')
+var tunnel = require('tunnel-agent')
var defaultProxyHeaderWhiteList = [
'accept',
@@ -31,10 +31,10 @@ var defaultProxyHeaderExclusiveList = [
'proxy-authorization'
]
-function constructProxyHost(uriObject) {
+function constructProxyHost (uriObject) {
var port = uriObject.port
- , protocol = uriObject.protocol
- , proxyHost = uriObject.hostname + ':'
+ var protocol = uriObject.protocol
+ var proxyHost = uriObject.hostname + ':'
if (port) {
proxyHost += port
@@ -47,7 +47,7 @@ function constructProxyHost(uriObject) {
return proxyHost
}
-function constructProxyHeaderWhiteList(headers, proxyHeaderWhiteList) {
+function constructProxyHeaderWhiteList (headers, proxyHeaderWhiteList) {
var whiteList = proxyHeaderWhiteList
.reduce(function (set, header) {
set[header.toLowerCase()] = true
@@ -68,41 +68,40 @@ function constructTunnelOptions (request, proxyHeaders) {
var proxy = request.proxy
var tunnelOptions = {
- proxy : {
- host : proxy.hostname,
- port : +proxy.port,
- proxyAuth : proxy.auth,
- headers : proxyHeaders
+ proxy: {
+ host: proxy.hostname,
+ port: +proxy.port,
+ proxyAuth: proxy.auth,
+ headers: proxyHeaders
},
- headers : request.headers,
- ca : request.ca,
- cert : request.cert,
- key : request.key,
- passphrase : request.passphrase,
- pfx : request.pfx,
- ciphers : request.ciphers,
- rejectUnauthorized : request.rejectUnauthorized,
- secureOptions : request.secureOptions,
- secureProtocol : request.secureProtocol
+ headers: request.headers,
+ ca: request.ca,
+ cert: request.cert,
+ key: request.key,
+ passphrase: request.passphrase,
+ pfx: request.pfx,
+ ciphers: request.ciphers,
+ rejectUnauthorized: request.rejectUnauthorized,
+ secureOptions: request.secureOptions,
+ secureProtocol: request.secureProtocol
}
return tunnelOptions
}
-function constructTunnelFnName(uri, proxy) {
+function constructTunnelFnName (uri, proxy) {
var uriProtocol = (uri.protocol === 'https:' ? 'https' : 'http')
var proxyProtocol = (proxy.protocol === 'https:' ? 'Https' : 'Http')
return [uriProtocol, proxyProtocol].join('Over')
}
-function getTunnelFn(request) {
+function getTunnelFn (request) {
var uri = request.uri
var proxy = request.proxy
var tunnelFnName = constructTunnelFnName(uri, proxy)
return tunnel[tunnelFnName]
}
-
function Tunnel (request) {
this.request = request
this.proxyHeaderWhiteList = defaultProxyHeaderWhiteList
@@ -114,8 +113,8 @@ function Tunnel (request) {
Tunnel.prototype.isEnabled = function () {
var self = this
- , request = self.request
- // Tunnel HTTPS by default. Allow the user to override this setting.
+ var request = self.request
+ // Tunnel HTTPS by default. Allow the user to override this setting.
// If self.tunnelOverride is set (the user specified a value), use it.
if (typeof self.tunnelOverride !== 'undefined') {
@@ -133,7 +132,7 @@ Tunnel.prototype.isEnabled = function () {
Tunnel.prototype.setup = function (options) {
var self = this
- , request = self.request
+ var request = self.request
options = options || {}
diff --git a/node_modules/request/package.json b/node_modules/request/package.json
index 8f492a21e..4c9b84ccb 100644
--- a/node_modules/request/package.json
+++ b/node_modules/request/package.json
@@ -1,31 +1,30 @@
{
- "_from": "request@2.81.0",
- "_id": "request@2.81.0",
+ "_from": "request@latest",
+ "_id": "request@2.87.0",
"_inBundle": false,
- "_integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=",
+ "_integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==",
"_location": "/request",
"_phantomChildren": {},
"_requested": {
- "type": "version",
+ "type": "tag",
"registry": true,
- "raw": "request@2.81.0",
+ "raw": "request@latest",
"name": "request",
"escapedName": "request",
- "rawSpec": "2.81.0",
+ "rawSpec": "latest",
"saveSpec": null,
- "fetchSpec": "2.81.0"
+ "fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
"/",
"/couchapp",
"/coveralls",
- "/node-gyp",
"/npm-registry-client"
],
- "_resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz",
- "_shasum": "c6928946a0e06c5f8d6f8a9333469ffda46298a0",
- "_spec": "request@2.81.0",
+ "_resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz",
+ "_shasum": "32f00235cd08d482b4d0d68db93a829c0ed5756e",
+ "_spec": "request@latest",
"_where": "/Users/zkat/Documents/code/work/npm",
"author": {
"name": "Mikeal Rogers",
@@ -36,28 +35,26 @@
},
"bundleDependencies": false,
"dependencies": {
- "aws-sign2": "~0.6.0",
- "aws4": "^1.2.1",
+ "aws-sign2": "~0.7.0",
+ "aws4": "^1.6.0",
"caseless": "~0.12.0",
"combined-stream": "~1.0.5",
- "extend": "~3.0.0",
+ "extend": "~3.0.1",
"forever-agent": "~0.6.1",
- "form-data": "~2.1.1",
- "har-validator": "~4.2.1",
- "hawk": "~3.1.3",
- "http-signature": "~1.1.0",
+ "form-data": "~2.3.1",
+ "har-validator": "~5.0.3",
+ "http-signature": "~1.2.0",
"is-typedarray": "~1.0.0",
"isstream": "~0.1.2",
"json-stringify-safe": "~5.0.1",
- "mime-types": "~2.1.7",
- "oauth-sign": "~0.8.1",
- "performance-now": "^0.2.0",
- "qs": "~6.4.0",
- "safe-buffer": "^5.0.1",
- "stringstream": "~0.0.4",
- "tough-cookie": "~2.3.0",
+ "mime-types": "~2.1.17",
+ "oauth-sign": "~0.8.2",
+ "performance-now": "^2.1.0",
+ "qs": "~6.5.1",
+ "safe-buffer": "^5.1.1",
+ "tough-cookie": "~2.3.3",
"tunnel-agent": "^0.6.0",
- "uuid": "^3.0.0"
+ "uuid": "^3.1.0"
},
"deprecated": false,
"description": "Simplified HTTP request client.",
@@ -66,9 +63,8 @@
"browserify": "^13.0.1",
"browserify-istanbul": "^2.0.0",
"buffer-equal": "^1.0.0",
- "codecov": "^1.0.1",
+ "codecov": "^2.0.2",
"coveralls": "^2.11.4",
- "eslint": "^2.5.3",
"function-bind": "^1.0.2",
"istanbul": "^0.4.0",
"karma": "^1.1.1",
@@ -80,6 +76,7 @@
"phantomjs-prebuilt": "^2.1.3",
"rimraf": "^2.2.8",
"server-destroy": "^1.0.1",
+ "standard": "^9.0.0",
"tape": "^4.6.0",
"taper": "^0.5.0"
},
@@ -93,7 +90,6 @@
],
"greenkeeper": {
"ignore": [
- "eslint",
"hawk",
"har-validator"
]
@@ -113,11 +109,11 @@
"url": "git+https://github.com/request/request.git"
},
"scripts": {
- "lint": "eslint lib/ *.js tests/ && echo Lint passed.",
+ "lint": "standard",
"test": "npm run lint && npm run test-ci && npm run test-browser",
"test-browser": "node tests/browser/start.js",
"test-ci": "taper tests/test-*.js",
"test-cov": "istanbul cover tape tests/test-*.js"
},
- "version": "2.81.0"
+ "version": "2.87.0"
}
diff --git a/node_modules/request/request.js b/node_modules/request/request.js
index 467524ba4..668d9a81e 100644
--- a/node_modules/request/request.js
+++ b/node_modules/request/request.js
@@ -1,48 +1,46 @@
'use strict'
var http = require('http')
- , https = require('https')
- , url = require('url')
- , util = require('util')
- , stream = require('stream')
- , zlib = require('zlib')
- , hawk = require('hawk')
- , aws2 = require('aws-sign2')
- , aws4 = require('aws4')
- , httpSignature = require('http-signature')
- , mime = require('mime-types')
- , stringstream = require('stringstream')
- , caseless = require('caseless')
- , ForeverAgent = require('forever-agent')
- , FormData = require('form-data')
- , extend = require('extend')
- , isstream = require('isstream')
- , isTypedArray = require('is-typedarray').strict
- , helpers = require('./lib/helpers')
- , cookies = require('./lib/cookies')
- , getProxyFromURI = require('./lib/getProxyFromURI')
- , Querystring = require('./lib/querystring').Querystring
- , Har = require('./lib/har').Har
- , Auth = require('./lib/auth').Auth
- , OAuth = require('./lib/oauth').OAuth
- , Multipart = require('./lib/multipart').Multipart
- , Redirect = require('./lib/redirect').Redirect
- , Tunnel = require('./lib/tunnel').Tunnel
- , now = require('performance-now')
- , Buffer = require('safe-buffer').Buffer
+var https = require('https')
+var url = require('url')
+var util = require('util')
+var stream = require('stream')
+var zlib = require('zlib')
+var aws2 = require('aws-sign2')
+var aws4 = require('aws4')
+var httpSignature = require('http-signature')
+var mime = require('mime-types')
+var caseless = require('caseless')
+var ForeverAgent = require('forever-agent')
+var FormData = require('form-data')
+var extend = require('extend')
+var isstream = require('isstream')
+var isTypedArray = require('is-typedarray').strict
+var helpers = require('./lib/helpers')
+var cookies = require('./lib/cookies')
+var getProxyFromURI = require('./lib/getProxyFromURI')
+var Querystring = require('./lib/querystring').Querystring
+var Har = require('./lib/har').Har
+var Auth = require('./lib/auth').Auth
+var OAuth = require('./lib/oauth').OAuth
+var hawk = require('./lib/hawk')
+var Multipart = require('./lib/multipart').Multipart
+var Redirect = require('./lib/redirect').Redirect
+var Tunnel = require('./lib/tunnel').Tunnel
+var now = require('performance-now')
+var Buffer = require('safe-buffer').Buffer
var safeStringify = helpers.safeStringify
- , isReadStream = helpers.isReadStream
- , toBase64 = helpers.toBase64
- , defer = helpers.defer
- , copy = helpers.copy
- , version = helpers.version
- , globalCookieJar = cookies.jar()
-
+var isReadStream = helpers.isReadStream
+var toBase64 = helpers.toBase64
+var defer = helpers.defer
+var copy = helpers.copy
+var version = helpers.version
+var globalCookieJar = cookies.jar()
var globalPool = {}
-function filterForNonReserved(reserved, options) {
+function filterForNonReserved (reserved, options) {
// Filter out properties that are not reserved.
// Reserved values are passed in at call site.
@@ -56,7 +54,7 @@ function filterForNonReserved(reserved, options) {
return object
}
-function filterOutReservedFunctions(reserved, options) {
+function filterOutReservedFunctions (reserved, options) {
// Filter out properties that are functions and are reserved.
// Reserved values are passed in at call site.
@@ -69,11 +67,10 @@ function filterOutReservedFunctions(reserved, options) {
}
}
return object
-
}
// Return a simpler request object to allow serialization
-function requestToJSON() {
+function requestToJSON () {
var self = this
return {
uri: self.uri,
@@ -83,7 +80,7 @@ function requestToJSON() {
}
// Return a simpler response object to allow serialization
-function responseToJSON() {
+function responseToJSON () {
var self = this
return {
statusCode: self.statusCode,
@@ -134,7 +131,7 @@ util.inherits(Request, stream.Stream)
// Debugging
Request.debug = process.env.NODE_DEBUG && /\brequest\b/.test(process.env.NODE_DEBUG)
-function debug() {
+function debug () {
if (Request.debug) {
console.error('REQUEST %s', util.format.apply(util, arguments))
}
@@ -258,7 +255,7 @@ Request.prototype.init = function (options) {
self.rejectUnauthorized = false
}
- if (!self.uri.pathname) {self.uri.pathname = '/'}
+ if (!self.uri.pathname) { self.uri.pathname = '/' }
if (!(self.uri.host || (self.uri.hostname && self.uri.port)) && !self.uri.isUnix) {
// Invalid URI: it may generate lot of bad errors, like 'TypeError: Cannot call method `indexOf` of undefined' in CookieJar
@@ -300,8 +297,7 @@ Request.prototype.init = function (options) {
self.jar(self._jar || options.jar)
if (!self.uri.port) {
- if (self.uri.protocol === 'http:') {self.uri.port = 80}
- else if (self.uri.protocol === 'https:') {self.uri.port = 443}
+ if (self.uri.protocol === 'http:') { self.uri.port = 80 } else if (self.uri.protocol === 'https:') { self.uri.port = 443 }
}
if (self.proxy && !self.tunnel) {
@@ -388,12 +384,12 @@ Request.prototype.init = function (options) {
}
if (self.uri.auth && !self.hasHeader('authorization')) {
- var uriAuthPieces = self.uri.auth.split(':').map(function(item) {return self._qs.unescape(item)})
+ var uriAuthPieces = self.uri.auth.split(':').map(function (item) { return self._qs.unescape(item) })
self.auth(uriAuthPieces[0], uriAuthPieces.slice(1).join(':'), true)
}
if (!self.tunnel && self.proxy && self.proxy.auth && !self.hasHeader('proxy-authorization')) {
- var proxyAuthPieces = self.proxy.auth.split(':').map(function(item) {return self._qs.unescape(item)})
+ var proxyAuthPieces = self.proxy.auth.split(':').map(function (item) { return self._qs.unescape(item) })
var authHeader = 'Basic ' + toBase64(proxyAuthPieces.join(':'))
self.setHeader('proxy-authorization', authHeader)
}
@@ -425,11 +421,9 @@ Request.prototype.init = function (options) {
var length
if (typeof self.body === 'string') {
length = Buffer.byteLength(self.body)
- }
- else if (Array.isArray(self.body)) {
- length = self.body.reduce(function (a, b) {return a + b.length}, 0)
- }
- else {
+ } else if (Array.isArray(self.body)) {
+ length = self.body.reduce(function (a, b) { return a + b.length }, 0)
+ } else {
length = self.body.length
}
@@ -451,8 +445,8 @@ Request.prototype.init = function (options) {
}
var protocol = self.proxy && !self.tunnel ? self.proxy.protocol : self.uri.protocol
- , defaultModules = {'http:':http, 'https:':https}
- , httpModules = self.httpModules || {}
+ var defaultModules = {'http:': http, 'https:': https}
+ var httpModules = self.httpModules || {}
self.httpModule = httpModules[protocol] || defaultModules[protocol]
@@ -517,9 +511,9 @@ Request.prototype.init = function (options) {
}
}
- // self.on('pipe', function () {
- // console.error('You have already piped to this stream. Pipeing twice is likely to break the request.')
- // })
+ // self.on('pipe', function () {
+ // console.error('You have already piped to this stream. Pipeing twice is likely to break the request.')
+ // })
})
defer(function () {
@@ -531,8 +525,7 @@ Request.prototype.init = function (options) {
if (self._form) {
if (!self._auth.hasAuth) {
self._form.pipe(self)
- }
- else if (self._auth.hasAuth && self._auth.sentAuth) {
+ } else if (self._auth.hasAuth && self._auth.sentAuth) {
self._form.pipe(self)
}
}
@@ -583,7 +576,6 @@ Request.prototype.init = function (options) {
self.ntick = true
})
-
}
Request.prototype.getNewAgent = function () {
@@ -778,21 +770,22 @@ Request.prototype.start = function () {
self.req.on('response', self.onRequestResponse.bind(self))
self.req.on('error', self.onRequestError.bind(self))
- self.req.on('drain', function() {
+ self.req.on('drain', function () {
self.emit('drain')
})
- self.req.on('socket', function(socket) {
+
+ self.req.on('socket', function (socket) {
// `._connecting` was the old property which was made public in node v6.1.0
var isConnecting = socket._connecting || socket.connecting
if (self.timing) {
self.timings.socket = now() - self.startTimeNow
if (isConnecting) {
- var onLookupTiming = function() {
+ var onLookupTiming = function () {
self.timings.lookup = now() - self.startTimeNow
}
- var onConnectTiming = function() {
+ var onConnectTiming = function () {
self.timings.connect = now() - self.startTimeNow
}
@@ -800,14 +793,14 @@ Request.prototype.start = function () {
socket.once('connect', onConnectTiming)
// clean up timing event listeners if needed on error
- self.req.once('error', function() {
+ self.req.once('error', function () {
socket.removeListener('lookup', onLookupTiming)
socket.removeListener('connect', onConnectTiming)
})
}
}
- var setReqTimeout = function() {
+ var setReqTimeout = function () {
// This timeout sets the amount of time to wait *between* bytes sent
// from the server once connected.
//
@@ -829,7 +822,7 @@ Request.prototype.start = function () {
// keep-alive connection) do not bother. This is important since we won't
// get a 'connect' event for an already connected socket.
if (isConnecting) {
- var onReqSockConnect = function() {
+ var onReqSockConnect = function () {
socket.removeListener('connect', onReqSockConnect)
clearTimeout(self.timeoutTimer)
self.timeoutTimer = null
@@ -838,7 +831,7 @@ Request.prototype.start = function () {
socket.on('connect', onReqSockConnect)
- self.req.on('error', function(err) {
+ self.req.on('error', function (err) { // eslint-disable-line handle-callback-err
socket.removeListener('connect', onReqSockConnect)
})
@@ -870,8 +863,8 @@ Request.prototype.onRequestError = function (error) {
if (self._aborted) {
return
}
- if (self.req && self.req._reusedSocket && error.code === 'ECONNRESET'
- && self.agent.addRequestNoreuse) {
+ if (self.req && self.req._reusedSocket && error.code === 'ECONNRESET' &&
+ self.agent.addRequestNoreuse) {
self.agent = { addRequest: self.agent.addRequestNoreuse.bind(self.agent) }
self.start()
self.req.end()
@@ -892,7 +885,7 @@ Request.prototype.onRequestResponse = function (response) {
}
debug('onRequestResponse', self.uri.href, response.statusCode, response.headers)
- response.on('end', function() {
+ response.on('end', function () {
if (self.timing) {
self.timings.end = now() - self.startTimeNow
response.timingStart = self.startTime
@@ -948,8 +941,8 @@ Request.prototype.onRequestResponse = function (response) {
// XXX This is different on 0.10, because SSL is strict by default
if (self.httpModule === https &&
- self.strictSSL && (!response.hasOwnProperty('socket') ||
- !response.socket.authorized)) {
+ self.strictSSL && (!response.hasOwnProperty('socket') ||
+ !response.socket.authorized)) {
debug('strict ssl error', self.uri.href)
var sslErr = response.hasOwnProperty('socket') ? response.socket.authorizationError : self.uri.href + ' does not support SSL'
self.emit('error', new Error('SSL Error: ' + sslErr))
@@ -974,7 +967,7 @@ Request.prototype.onRequestResponse = function (response) {
var targetCookieJar = (self._jar && self._jar.setCookie) ? self._jar : globalCookieJar
var addCookie = function (cookie) {
- //set the cookie if it's domain in the href's domain.
+ // set the cookie if it's domain in the href's domain.
try {
targetCookieJar.setCookie(cookie, self.uri.href, {ignoreError: true})
} catch (e) {
@@ -1010,13 +1003,13 @@ Request.prototype.onRequestResponse = function (response) {
var noBody = function (code) {
return (
- self.method === 'HEAD'
+ self.method === 'HEAD' ||
// Informational
- || (code >= 100 && code < 200)
+ (code >= 100 && code < 200) ||
// No Content
- || code === 204
+ code === 204 ||
// Not Modified
- || code === 304
+ code === 304
)
}
@@ -1030,8 +1023,8 @@ Request.prototype.onRequestResponse = function (response) {
// by common browsers.
// Always using Z_SYNC_FLUSH is what cURL does.
var zlibOptions = {
- flush: zlib.Z_SYNC_FLUSH
- , finishFlush: zlib.Z_SYNC_FLUSH
+ flush: zlib.Z_SYNC_FLUSH,
+ finishFlush: zlib.Z_SYNC_FLUSH
}
if (contentEncoding === 'gzip') {
@@ -1055,13 +1048,8 @@ Request.prototype.onRequestResponse = function (response) {
if (self.encoding) {
if (self.dests.length !== 0) {
console.error('Ignoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.')
- } else if (responseContent.setEncoding) {
- responseContent.setEncoding(self.encoding)
} else {
- // Should only occur on node pre-v0.9.4 (joyent/node@9b5abe5) with
- // zlib streams.
- // If/When support for 0.9.4 is dropped, this should be unnecessary.
- responseContent = responseContent.pipe(stringstream(self.encoding))
+ responseContent.setEncoding(self.encoding)
}
}
@@ -1093,13 +1081,11 @@ Request.prototype.onRequestResponse = function (response) {
responseContent.on('error', function (error) {
self.emit('error', error)
})
- responseContent.on('close', function () {self.emit('close')})
+ responseContent.on('close', function () { self.emit('close') })
if (self.callback) {
self.readResponseBody(response)
- }
- //if no callback
- else {
+ } else { // if no callback
self.on('end', function () {
if (self._aborted) {
debug('aborted', self.uri.href)
@@ -1114,10 +1100,10 @@ Request.prototype.onRequestResponse = function (response) {
Request.prototype.readResponseBody = function (response) {
var self = this
- debug('reading response\'s body')
+ debug("reading response's body")
var buffers = []
- , bufferLength = 0
- , strings = []
+ var bufferLength = 0
+ var strings = []
self.on('data', function (chunk) {
if (!Buffer.isBuffer(chunk)) {
@@ -1178,8 +1164,7 @@ Request.prototype.abort = function () {
if (self.req) {
self.req.abort()
- }
- else if (self.response) {
+ } else if (self.response) {
self.response.destroy()
}
@@ -1195,8 +1180,7 @@ Request.prototype.pipeDest = function (dest) {
var ctname = response.caseless.has('content-type')
if (dest.setHeader) {
dest.setHeader(ctname, response.headers[ctname])
- }
- else {
+ } else {
dest.headers[ctname] = response.headers[ctname]
}
}
@@ -1267,7 +1251,7 @@ Request.prototype.form = function (form) {
}
// create form-data object
self._form = new FormData()
- self._form.on('error', function(err) {
+ self._form.on('error', function (err) {
err.message = 'form-data: ' + err.message
self.emit('error', err)
self.abort()
@@ -1342,8 +1326,8 @@ Request.prototype.getHeader = function (name, headers) {
Request.prototype.enableUnixSocket = function () {
// Get the socket & request paths from the URL
var unixParts = this.uri.path.split(':')
- , host = unixParts[0]
- , path = unixParts[1]
+ var host = unixParts[0]
+ var path = unixParts[1]
// Apply unix properties to request
this.socketPath = host
this.uri.pathname = path
@@ -1353,7 +1337,6 @@ Request.prototype.enableUnixSocket = function () {
this.uri.isUnix = true
}
-
Request.prototype.auth = function (user, pass, sendImmediately, bearer) {
var self = this
@@ -1369,7 +1352,7 @@ Request.prototype.aws = function (opts, now) {
return self
}
- if (opts.sign_version == 4 || opts.sign_version == '4') {
+ if (opts.sign_version === 4 || opts.sign_version === '4') {
// use aws4
var options = {
host: self.uri.host,
@@ -1390,20 +1373,19 @@ Request.prototype.aws = function (opts, now) {
if (signRes.headers['X-Amz-Security-Token']) {
self.setHeader('x-amz-security-token', signRes.headers['X-Amz-Security-Token'])
}
- }
- else {
+ } else {
// default: use aws-sign2
var date = new Date()
self.setHeader('date', date.toUTCString())
- var auth =
- { key: opts.key
- , secret: opts.secret
- , verb: self.method.toUpperCase()
- , date: date
- , contentType: self.getHeader('content-type') || ''
- , md5: self.getHeader('content-md5') || ''
- , amazonHeaders: aws2.canonicalizeHeaders(self.headers)
- }
+ var auth = {
+ key: opts.key,
+ secret: opts.secret,
+ verb: self.method.toUpperCase(),
+ date: date,
+ contentType: self.getHeader('content-type') || '',
+ md5: self.getHeader('content-md5') || '',
+ amazonHeaders: aws2.canonicalizeHeaders(self.headers)
+ }
var path = self.uri.path
if (opts.bucket && path) {
auth.resource = '/' + opts.bucket + path
@@ -1423,10 +1405,10 @@ Request.prototype.aws = function (opts, now) {
Request.prototype.httpSignature = function (opts) {
var self = this
httpSignature.signRequest({
- getHeader: function(header) {
+ getHeader: function (header) {
return self.getHeader(header, self.headers)
},
- setHeader: function(header, value) {
+ setHeader: function (header, value) {
self.setHeader(header, value)
},
method: self.method,
@@ -1438,7 +1420,7 @@ Request.prototype.httpSignature = function (opts) {
}
Request.prototype.hawk = function (opts) {
var self = this
- self.setHeader('Authorization', hawk.client.header(self.uri, self.method, opts).field)
+ self.setHeader('Authorization', hawk.header(self.uri, self.method, opts))
}
Request.prototype.oauth = function (_oauth) {
var self = this
@@ -1463,13 +1445,13 @@ Request.prototype.jar = function (jar) {
} else {
var targetCookieJar = (jar && jar.getCookieString) ? jar : globalCookieJar
var urihref = self.uri.href
- //fetch cookie in the Specified host
+ // fetch cookie in the Specified host
if (targetCookieJar) {
cookies = targetCookieJar.getCookieString(urihref)
}
}
- //if need cookie and cookie is not empty
+ // if need cookie and cookie is not empty
if (cookies && cookies.length) {
if (self.originalCookieHeader) {
// Don't overwrite existing Cookie header
@@ -1482,7 +1464,6 @@ Request.prototype.jar = function (jar) {
return self
}
-
// Stream API
Request.prototype.pipe = function (dest, opts) {
var self = this
@@ -1505,7 +1486,7 @@ Request.prototype.pipe = function (dest, opts) {
}
Request.prototype.write = function () {
var self = this
- if (self._aborted) {return}
+ if (self._aborted) { return }
if (!self._started) {
self.start()
@@ -1516,7 +1497,7 @@ Request.prototype.write = function () {
}
Request.prototype.end = function (chunk) {
var self = this
- if (self._aborted) {return}
+ if (self._aborted) { return }
if (chunk) {
self.write(chunk)