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.2 to 3.6.3

11

lib/response.js

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

Response.prototype.setTimeout = function (msecs, callback) {
this.timeoutHandle = setTimeout(() => {
this.emit('timeout')
}, msecs)
this.on('timeout', callback)
return this
}
Response.prototype.writeHead = function () {

@@ -69,2 +77,5 @@ const result = http.ServerResponse.prototype.writeHead.apply(this, arguments)

Response.prototype.write = function (data, encoding, callback) {
if (this.timeoutHandle) {
clearTimeout(this.timeoutHandle)
}
http.ServerResponse.prototype.write.call(this, data, encoding, callback)

@@ -71,0 +82,0 @@ this._lightMyRequest.payloadChunks.push(Buffer.from(data, encoding))

6

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

@@ -12,4 +12,4 @@ "main": "index.js",

"devDependencies": {
"@types/node": "^12.11.6",
"form-data": "^2.5.1",
"@types/node": "^13.1.0",
"form-data": "^3.0.0",
"pre-commit": "^1.2.2",

@@ -16,0 +16,0 @@ "standard": "^14.0.2",

@@ -850,2 +850,24 @@ 'use strict'

test('should handle response timeout handler', (t) => {
t.plan(3)
const dispatch = function (req, res) {
const handle = setTimeout(() => {
res.writeHead(200, { 'Content-Type': 'text/plain' })
res.end('incorrect')
}, 200)
res.setTimeout(100, () => {
clearTimeout(handle)
res.writeHead(200, { 'Content-Type': 'text/plain' })
res.end('correct')
})
res.on('timeout', () => {
t.ok(true, 'Response timeout event not emitted')
})
}
inject(dispatch, { method: 'GET', url: '/test' }, (err, res) => {
t.error(err)
t.equal(res.payload, 'correct')
})
})
test('should throw on unknown HTTP method', (t) => {

@@ -852,0 +874,0 @@ t.plan(1)

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