Socket
Socket
Sign inDemoInstall

stoppable

Package Overview
Dependencies
0
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.4 to 1.0.5

9

package.json
{
"name": "stoppable",
"version": "1.0.4",
"version": "1.0.5",
"engines": {
"node": ">=7.6.0"
"node": ">=6"
},
"keywords": [],
"repository": "hunterloftis/stoppable",
"scripts": {

@@ -22,2 +23,3 @@ "lint": "standard --fix 'lib/**/*.js'",

"artillery": "^1.6.0-2",
"awaiting": "^2.2.0",
"chai": "^3.5.0",

@@ -30,6 +32,3 @@ "documentation": "^4.0.0-rc.1",

"standard": "^8.6.0"
},
"dependencies": {
"awaiting": "^2.2.0"
}
}

@@ -53,20 +53,18 @@ const http = require('http')

describe('without keep-alive connections', () => {
describe('without keep-alive connections', () => {
let closed = 0
it('stops accepting new connections', async () => {
const server = stoppable(http.createServer((req, res) => res.end('hello')))
server.on('close', () => closed++)
server.listen(8000)
await a.event(server, 'listening')
const res1 = await request('http://localhost:8000').agent(new http.Agent())
const text1 = await res1.text()
assert.equal(text1, 'hello')
server.stop()
const err = await a.failure(request('http://localhost:8000').agent(new http.Agent()))
assert.match(err.message, /ECONNREFUSED/)
})
it('closes', () => {
assert.equal(closed, 1)
})
let closed = 0
it('stops accepting new connections', async () => {
const server = stoppable(http.createServer((req, res) => res.end('hello')))
server.on('close', () => closed++)
server.listen(8000)
await a.event(server, 'listening')
const res1 = await request('http://localhost:8000').agent(new http.Agent())
const text1 = await res1.text()
assert.equal(text1, 'hello')
server.stop()
const err = await a.failure(request('http://localhost:8000').agent(new http.Agent()))
assert.match(err.message, /ECONNREFUSED/)
})
it('closes', () => {
assert.equal(closed, 1)
})
})

@@ -73,0 +71,0 @@ describe('with keep-alive connections', () => {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc