Socket
Socket
Sign inDemoInstall

mitm

Package Overview
Dependencies
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mitm - npm Package Compare versions

Comparing version 1.7.2 to 1.7.3

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## 1.7.3 (Aug 26, 2024)
- Removes the [Underscore.js](https://underscorejs.org) dependency in favor of just inlining two rewritten helper functions.
- Fixes possible double emitting on Node v19+ due to its global HTTP agent enabling keep-alive.
## 1.7.2 (May 1, 2021)

@@ -2,0 +6,0 @@ - Increases the upper-bound on [Underscore.js](https://underscorejs.org) dependency to v1.13 (inclusive).

@@ -1,2 +0,1 @@

var _ = require("underscore")
var Net = require("net")

@@ -66,6 +65,12 @@ var Tls = require("tls")

// Note v19 enables keep-alive for both the Http and Https globalAgents.
if (Http.globalAgent.keepAlive)
this.stubs.stub(Http.globalAgent, "keepAlive", false)
if (Https.globalAgent.keepAlive)
this.stubs.stub(Https.globalAgent, "keepAlive", false)
// ClientRequest.prototype.onSocket is called synchronously from
// ClientRequest's constructor and is a convenient place to hook into new
// ClientRequests.
this.stubs.stub(ClientRequest.prototype, "onSocket", _.compose(
this.stubs.stub(ClientRequest.prototype, "onSocket", compose(
ClientRequest.prototype.onSocket,

@@ -88,3 +93,3 @@ this.request.bind(this)

// and its afterConnect handler, but we're not calling that.
var client = new Socket(_.defaults({
var client = new Socket(defaults({
handle: sockets[0],

@@ -158,3 +163,3 @@

self = Object.create(this)
self.emit = _.compose(process.nextTick, Function.bind.bind(this.emit, this))
self.emit = compose(process.nextTick, Function.bind.bind(this.emit, this))
}

@@ -166,2 +171,21 @@

function compose() {
var fns = arguments
return function() {
var args = arguments
for (var i = fns.length - 1; i >= 0; --i) args = [fns[i].apply(this, args)]
return args[0]
}
}
function defaults(target) {
if (target != null) for (var i = 1; i < arguments.length; ++i) {
var source = arguments[i]
for (var key in source) if (!(key in target)) target[key] = source[key]
}
return target
}
function addCrossReferences(req, res) { req.res = res; res.req = req }

12

package.json
{
"name": "mitm",
"version": "1.7.2",
"version": "1.7.3",
"description": "Intercept and mock outgoing network TCP connections and HTTP requests for testing. Intercepts and gives you a Net.Socket, Http.IncomingMessage and Http.ServerResponse to test and respond with. Useful when testing code that hits remote servers.",

@@ -31,7 +31,3 @@ "keywords": [

"licenses": [{
"type": "LAGPL",
"url": "https://github.com/moll/node-mitm/blob/master/LICENSE"
}],
"license": "AGPL-3.0-or-later WITH GPL-3.0-linking-exception",
"main": "index.js",

@@ -41,3 +37,2 @@ "scripts": {"test": "make test"},

"dependencies": {
"underscore": ">= 1.1.6 < 1.14",
"semver": ">= 5 < 6"

@@ -49,3 +44,4 @@ },

"must": ">= 0.13 < 0.14",
"sinon": ">= 1.9 < 2"
"sinon": ">= 1.9 < 2",
"underscore": ">= 1.1.6 < 1.14"
},

@@ -52,0 +48,0 @@

Mitm.js
=======
[![NPM version][npm-badge]](https://www.npmjs.com/package/mitm)
[![Build status][travis-badge]](https://travis-ci.org/moll/node-mitm)
[![Build status][build-badge]](https://github.com/moll/node-mitm/actions/workflows/node.yaml)

@@ -19,3 +19,3 @@ Mitm.js is a library for Node.js (and Io.js) to **intercept and mock** outgoing

Mitm.js works on all Node versions: ancient **v0.10**, **v0.11** and **v0.12** versions, previous and current LTS versions like **v4** to **v12** and the newest **v13** and beyond. For all it has **automated tests** to ensure it will stay that way.
Mitm.js works on all Node versions: ancient **v0.10**, **v0.11** and **v0.12** versions, previous and current LTS versions like **v4** to **v12** and the newest **v22** and beyond. For all it has **automated tests** to ensure it will stay that way.

@@ -28,3 +28,3 @@ I've developed Mitm.js on a need-to basis for testing [Monday

[npm-badge]: https://img.shields.io/npm/v/mitm.svg
[travis-badge]: https://travis-ci.org/moll/node-mitm.svg?branch=master
[build-badge]: https://github.com/moll/js-j6pack/actions/workflows/node.yaml/badge.svg

@@ -31,0 +31,0 @@ ### Tour

@@ -731,13 +731,17 @@ var _ = require("underscore")

describe(".prototype.addListener", function() {
it("must be an alias to EventEmitter.prototype.addListener", function() {
Mitm.prototype.addListener.must.equal(EventEmitter.prototype.addListener)
_.each({
on: EventEmitter.prototype.on,
once: EventEmitter.prototype.once,
off: EventEmitter.prototype.removeListener,
addListener: EventEmitter.prototype.addListener,
removeListener: EventEmitter.prototype.removeListener,
emit: EventEmitter.prototype.emit
}, function(to, from) {
describe(".prototype." + from, function() {
it("must be an alias to EventEmitter.prototype", function() {
Mitm.prototype.must.have.property(from, to)
Mitm.prototype[from].must.be.a.function()
})
})
})
describe(".prototype.off", function() {
it("must be an alias to EventEmitter.prototype.removeListener", function() {
Mitm.prototype.off.must.equal(EventEmitter.prototype.removeListener)
})
})
})

@@ -744,0 +748,0 @@

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