New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

light-my-request

Package Overview
Dependencies
Maintainers
2
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

light-my-request - npm Package Compare versions

Comparing version 3.6.1 to 3.6.2

10

index.js

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

this._promise = null
if (this.option.autoStart !== false) {
process.nextTick(() => {
if (!this._hasInvoked) {
this.end()
}
})
}
}

@@ -174,4 +182,4 @@

}
this._hasInvoked = true
this._promise = doInject(this.dispatch, this.option)
this._hasInvoked = true
}

@@ -178,0 +186,0 @@ return this._promise[method](...args)

2

package.json
{
"name": "light-my-request",
"version": "3.6.1",
"version": "3.6.2",
"description": "Fake HTTP injection library",

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

@@ -160,2 +160,4 @@ # Light my Request

- `server` - Optional http server. It is used for binding the `dispatchFunc`.
- `autoStart` - Automatically start the request as soon as the method
is called. It is only valid when not passing a callback. Defaults to `true`.
- `callback` - the callback function using the signature `function (err, res)` where:

@@ -162,0 +164,0 @@ - `err` - error object

@@ -1267,2 +1267,39 @@ 'use strict'

test('promise api should auto start (fire and forget)', (t) => {
t.plan(1)
function dispatch (req, res) {
t.pass('dispatch called')
res.writeHead(200, { 'Content-Type': 'text/plain' })
res.end()
}
inject(dispatch, 'http://example.com:8080/hello')
})
test('disabling autostart', (t) => {
t.plan(3)
let called = false
function dispatch (req, res) {
t.pass('dispatch called')
called = true
res.writeHead(200, { 'Content-Type': 'text/plain' })
res.end()
}
const p = inject(dispatch, {
url: 'http://example.com:8080/hello',
autoStart: false
})
setImmediate(() => {
t.equal(called, false)
p.then(() => {
t.equal(called, true)
})
})
})
function getTestStream (encoding) {

@@ -1269,0 +1306,0 @@ const word = 'hi'

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