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 14.0.2 to 14.1.0

35

lib/index.js

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

stream.pipe(req);
internals.deferPipeUntilSocketConnects(req, stream);
return req;

@@ -332,2 +332,27 @@ }

internals.deferPipeUntilSocketConnects = function (req, stream) {
const onSocket = (socket) => {
if (!socket.connecting) {
return onSocketConnect();
}
socket.once('connect', onSocketConnect);
};
const onSocketConnect = () => {
stream.pipe(req);
stream.removeListener('error', onStreamError);
};
const onStreamError = (err) => {
req.emit('error', err);
};
req.once('socket', onSocket);
stream.on('error', onStreamError);
};
internals.redirectMethod = function (code, method, options) {

@@ -446,2 +471,10 @@

// Workaround https://github.com/nodejs/node/pull/20611
// This is covered in node 10
/* $lab:coverage:off$ */
if (res.complete) {
return;
}
/* $lab:coverage:on$ */
return finishOnce(Boom.internal('Payload stream closed prematurely'));

@@ -448,0 +481,0 @@ };

2

lib/payload.js

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

size = size + chunk.length;
data[i] = Buffer.isBuffer(chunk) ? chunk : new Buffer(chunk);
data[i] = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
}

@@ -26,0 +26,0 @@

@@ -43,4 +43,4 @@ 'use strict';

const buffer = (this.buffers.length === 0 ? new Buffer(0) : (this.buffers.length === 1 ? this.buffers[0] : Buffer.concat(this.buffers, this.length)));
const buffer = (this.buffers.length === 0 ? Buffer.alloc(0) : (this.buffers.length === 1 ? this.buffers[0] : Buffer.concat(this.buffers, this.length)));
return buffer;
};
{
"name": "wreck",
"description": "HTTP Client Utilities",
"version": "14.0.2",
"version": "14.1.0",
"repository": "git://github.com/hapijs/wreck",

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

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

baseUrl: 'https://www.example.com',
payload: readableStream || 'foo=bar' || new Buffer('foo=bar'),
payload: readableStream || 'foo=bar' || Buffer.from('foo=bar'),
headers: { /* http headers */ },

@@ -276,3 +276,3 @@ redirects: 3,

```javascript
const stream = Wreck.toReadableStream(new Buffer('Hello', 'ascii'), 'ascii');
const stream = Wreck.toReadableStream(Buffer.from('Hello', 'ascii'), 'ascii');
const read = stream.read();

@@ -279,0 +279,0 @@ // read -> 'Hello'

Sorry, the diff of this file is not supported yet

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