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

probe

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

probe - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

10

lib/ping.js

@@ -8,6 +8,8 @@ 'use strict'

class Ping {
constructor () {
constructor (options) {
this.startTime = null
this.endTime = null
this.req = new Req()
this.options = options
this.req = new Req(this.options)
}

@@ -31,2 +33,6 @@

destroy (cb) {
this.req.abort(cb)
}
end () {

@@ -33,0 +39,0 @@ this.endTime = Date.now()

@@ -10,2 +10,3 @@ 'use strict'

super()
this.options = Object.assign({}, options)
this.http = http

@@ -87,2 +88,15 @@ this._req = null

if (this.options.timeout || opts.timeout) {
this._req.setTimeout(this.options.timeout || this.options.timeout, () => {
if (this.hasReturned) {
return
}
this.hasReturned = true
const err = new Error('has timed out.')
err.name = 'TimeoutError'
return cb(err)
})
}
this._req.on('error', (err) => {

@@ -89,0 +103,0 @@ if (this.hasReturned) {

2

package.json
{
"name": "probe",
"version": "2.1.0",
"version": "2.2.0",
"description": "Ping and probe stuff.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -20,1 +20,18 @@ 'use strict'

})
test('Throws a timeout', (t) => {
t.plan(4)
const config = {
host: 'something.local',
path:'/'
}
const req = new HTTPRequest({timeout: 50})
req.start(config, (err, res) => {
t.ok(err)
t.equals(err.name, 'TimeoutError')
t.notOk(res)
t.pass()
t.end()
})
})
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