Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

toxy

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

toxy - npm Package Compare versions

Comparing version 0.3.5 to 0.3.6

2

examples/time-threshold.js

@@ -16,3 +16,3 @@ const toxy = require('..')

// Enable abort poison during 1 second every 5 seconds
.withRule(rules.timeThreshold({ duration: 2000, threshold: 1000 * 5 }))
.withRule(rules.timeThreshold({ duration: 1000, threshold: 1000 * 5 }))
.withRule(rules.method('GET'))

@@ -19,0 +19,0 @@

@@ -29,5 +29,3 @@ module.exports = Base

var item = this._searchInStack(mw, name)
if (item) {
return item.$of[action]()
}
if (item) return item.$of[action]()
return false

@@ -38,5 +36,3 @@ }

var item = this._searchInStack(mw, name)
if (item) {
return item.$of || item
}
if (item) return item.$of || item
return null

@@ -50,3 +46,3 @@ }

if (node.$name === name || node.$of === name
|| node.name === name || node === name) {
|| node.name === name || node === name) {
return node

@@ -53,0 +49,0 @@ }

@@ -6,5 +6,2 @@ const midware = require('midware')

const noop = function () {}
const defaultPort = +process.env.PORT || 3000
module.exports = Toxy

@@ -23,2 +20,4 @@

Toxy.PORT = +process.env.PORT || 3000
Toxy.prototype = Object.create(Proxy.prototype)

@@ -28,3 +27,3 @@

this.host = host
this.port = +port || defaultPort
this.port = +port || Toxy.PORT
Proxy.prototype.listen.call(this, this.port, host)

@@ -53,5 +52,3 @@ return this

// Re-dispatch route if reaches the final handler
route.use(function (req, res, next) {
route.dispatcher.doDispatch(req, res, noop)
})
finalHandler(route)

@@ -73,2 +70,19 @@ return route

function finalHandler(route) {
var isFinalHandler = false
route.use(function (req, res, next) {
if (!isFinalHandler) {
isFinalHandler = true
useRouteFinalHandler(route)
}
next()
})
}
function useRouteFinalHandler(route) {
route.use(function (req, res, next) {
route.dispatcher.doDispatch(req, res, noop)
})
}
function setupMiddleware(self) {

@@ -89,1 +103,3 @@ self.use(function (req, res, next) {

}
function noop() {}
{
"name": "toxy",
"version": "0.3.5",
"description": "Hackable HTTP proxy to simulate server failure scenarios and unexpected network conditions",
"version": "0.3.6",
"description": "Hackable HTTP proxy to simulate server failure scenarios and network conditions",
"repository": "h2non/toxy",

@@ -19,2 +19,3 @@ "author": "Tomas Aparicio",

"resiliency",
"resilient",
"fuzz",

@@ -24,3 +25,2 @@ "evil",

"failure",
"resilient",
"retry",

@@ -27,0 +27,0 @@ "unexpected",

@@ -1013,2 +1013,10 @@ # toxy [![Build Status](https://api.travis-ci.org/h2non/toxy.svg?branch=master&style=flat)](https://travis-ci.org/h2non/toxy) [![Code Climate](https://codeclimate.com/github/h2non/toxy/badges/gpa.svg)](https://codeclimate.com/github/h2non/toxy) [![NPM](https://img.shields.io/npm/v/toxy.svg)](https://www.npmjs.org/package/toxy)

#### toxy#host(host)
Overwrite the `Host` header with a custom value. Similar to `forwardHost` option.
#### toxy#redirect(url)
Redirect traffic to the given URL.
#### toxy#findRoute(routeIdOrPath, [ method ])

@@ -1015,0 +1023,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