Socket
Socket
Sign inDemoInstall

agent-base

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

agent-base - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

5

History.md
4.0.1 / 2017-06-13
==================
* add `this` context tests and fixes
4.0.0 / 2017-06-06

@@ -3,0 +8,0 @@ ==================

10

index.js

@@ -40,7 +40,2 @@ 'use strict';

if (this.callback.length >= 3) {
// legacy callback function, convert to Promise
this.callback = promisify(this.callback);
}
// timeout for the socket to be returned from the callback

@@ -134,2 +129,7 @@ this.timeout = (opts && opts.timeout) || null;

if (this.callback.length >= 3) {
// legacy callback function, convert to Promise
this.callback = promisify(this.callback, this);
}
if (timeoutMs > 0) {

@@ -136,0 +136,0 @@ timeout = setTimeout(ontimeout, timeoutMs);

{
"name": "agent-base",
"version": "4.0.0",
"version": "4.0.1",
"description": "Turn a function into an `http.Agent` instance",

@@ -26,4 +26,4 @@ "main": "./index.js",

"devDependencies": {
"mocha": "3",
"ws": "0.8.0"
"mocha": "^3.4.2",
"ws": "^3.0.0"
},

@@ -30,0 +30,0 @@ "dependencies": {

@@ -47,2 +47,24 @@ /**

});
describe('`this` context', function() {
it('should be the Agent instance', function(done) {
var agent = new Agent();
agent.callback = function () {
assert.equal(this, agent);
done();
}
var info = url.parse('http://127.0.0.1/foo');
info.agent = agent;
http.get(info);
})
it('should be the Agent instance with callback signature', function(done) {
var agent = new Agent();
agent.callback = function (req, opts, fn) {
assert.equal(this, agent);
done();
}
var info = url.parse('http://127.0.0.1/foo');
info.agent = agent;
http.get(info);
})
})
describe('"error" event', function() {

@@ -49,0 +71,0 @@ it('should be invoked on `http.ClientRequest` instance if `callback()` has not been defined', function(

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