Socket
Socket
Sign inDemoInstall

wreck

Package Overview
Dependencies
Maintainers
4
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wreck - npm Package Compare versions

Comparing version 12.0.0 to 12.1.0

20

lib/index.js

@@ -21,3 +21,3 @@ 'use strict';

jsonRegex: /^application\/[a-z.+-]*json$/,
shallowOptions: ['agent', 'payload', 'downstreamRes', 'beforeRedirect', 'redirected'],
shallowOptions: ['agent', 'agents', 'beforeRedirect', 'downstreamRes', 'payload', 'redirected'],
emitSymbol: Symbol.for('wreck')

@@ -33,3 +33,9 @@ };

this.agents = {
defaults = defaults || {};
Hoek.assert(!defaults.agents || (defaults.agents.https && defaults.agents.http && defaults.agents.httpsAllowUnauthorized),
'defaults.agents must include "http", "https", and "httpsAllowUnauthorized"');
this._defaults = Hoek.cloneWithShallow(defaults, internals.shallowOptions);
this.agents = this._defaults.agents || {
https: new Https.Agent({ maxSockets: Infinity }),

@@ -40,4 +46,2 @@ http: new Http.Agent({ maxSockets: Infinity }),

this._defaults = defaults || {};
Events.EventEmitter.call(this);

@@ -61,3 +65,5 @@

options = Hoek.applyToDefaultsWithShallow(options, this._defaults, internals.shallowOptions);
Hoek.assert(options && (typeof options === 'object'), 'options must be provided to defaults');
options = Hoek.applyToDefaultsWithShallow(this._defaults, options, internals.shallowOptions);
return new internals.Client(options);

@@ -327,3 +333,3 @@ };

options = Hoek.applyToDefaultsWithShallow(options || {}, this._defaults, internals.shallowOptions);
options = Hoek.applyToDefaultsWithShallow(this._defaults, options || {}, internals.shallowOptions);

@@ -529,3 +535,3 @@ // Set stream timeout

if (!err && res.statusCode >= 400) {
return callback(Boom.create(res.statusCode, 'Response Error: ' + res.statusMessage, {
return callback(Boom.create(res.statusCode, new Error(`Response Error: ${res.statusMessage}`), {
isResponseError: true,

@@ -532,0 +538,0 @@ headers: res.headers,

{
"name": "wreck",
"description": "HTTP Client Utilities",
"version": "12.0.0",
"version": "12.1.0",
"repository": "git://github.com/hapijs/wreck",

@@ -6,0 +6,0 @@ "main": "lib/index",

@@ -39,6 +39,12 @@ ![wreck Logo](https://raw.github.com/hapijs/wreck/master/images/wreck.png)

const wreck = Wreck.defaults({
headers: { 'x-foo-bar': 123 }
headers: { 'x-foo-bar': 123 },
agents: {
https: new Https.Agent({ maxSockets: 100 }),
http: new Http.Agent({ maxSockets: 1000 }),
httpsAllowUnauthorized: new Https.Agent({ maxSockets: 100, rejectUnauthorized: false })
}
});
// cascading example -- does not alter `wreck`
// inherits `headers` and `agents` specified above
const wreckWithTimeout = wreck.defaults({

@@ -124,3 +130,3 @@ timeout: 5

- `err` - Any error that may have occurred during the handling of the request.
- `response` - The [HTTP Incoming Message](http://nodejs.org/api/http.html#http_http_incomingmessage)
- `response` - The [HTTP Incoming Message](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
object, which is also a readable stream.

@@ -155,4 +161,4 @@

- `data.headers` - object containing the response headers
- `data.payload` - the payload in the form of a Buffer or as a parsed object
- `response` - The [HTTP Incoming Message](http://nodejs.org/api/http.html#http_http_incomingmessage)
- `data.payload` - the payload in the form of a Buffer or as a parsed object
- `response` - The [HTTP Incoming Message](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
object, which is a readable stream that has "ended" and contains no more data to read.

@@ -175,3 +181,3 @@ - `payload` - The payload in the form of a Buffer or (optionally) parsed JavaScript object (JSON).

- `data.payload` - the payload in the form of a Buffer or as a parsed object
- `response` - The [HTTP Incoming Message](http://nodejs.org/api/http.html#http_http_incomingmessage)
- `response` - The [HTTP Incoming Message](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
object, which is a readable stream that has "ended" and contains no more data to read.

@@ -193,3 +199,3 @@ - `payload` - The payload in the form of a Buffer or (optionally) parsed JavaScript object (JSON).

- `data.payload` - the payload in the form of a Buffer or as a parsed object
- `response` - The [HTTP Incoming Message](http://nodejs.org/api/http.html#http_http_incomingmessage)
- `response` - The [HTTP Incoming Message](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
object, which is a readable stream that has "ended" and contains no more data to read.

@@ -212,3 +218,3 @@ - `payload` - The payload in the form of a Buffer or (optionally) parsed JavaScript object (JSON).

- `data.payload` - the payload in the form of a Buffer or as a parsed object
- `response` - The [HTTP Incoming Message](http://nodejs.org/api/http.html#http_http_incomingmessage)
- `response` - The [HTTP Incoming Message](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
object, which is a readable stream that has "ended" and contains no more data to read.

@@ -231,3 +237,3 @@ - `payload` - The payload in the form of a Buffer or (optionally) parsed JavaScript object (JSON).

- `data.payload` - the payload in the form of a Buffer or as a parsed object
- `response` - The [HTTP Incoming Message](http://nodejs.org/api/http.html#http_http_incomingmessage)
- `response` - The [HTTP Incoming Message](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
object, which is a readable stream that has "ended" and contains no more data to read.

@@ -270,3 +276,3 @@ - `payload` - The payload in the form of a Buffer or (optionally) parsed JavaScript object (JSON).

The properties are `http`, `https`, and `httpsAllowUnauthorized` which is an
`https` agent with `rejectUnauthorized` set to true. All agents have
`https` agent with `rejectUnauthorized` set to false. All agents have
`maxSockets` configured to `Infinity`. They are each instances of the Node.js

@@ -273,0 +279,0 @@ [Agent](http://nodejs.org/api/http.html#http_class_http_agent) and expose the

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