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.7.0 to 3.7.1

5

lib/request.js

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

const cookie = require('cookie')
const assert = require('assert')

@@ -50,3 +51,5 @@ const parseURL = require('./parseURL')

Object.keys(headers).forEach((field) => {
this.headers[field.toLowerCase()] = headers[field]
const value = headers[field]
assert(value !== undefined, 'invalid value "undefined" for header ' + field)
this.headers[field.toLowerCase()] = '' + value
})

@@ -53,0 +56,0 @@

2

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

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

@@ -1433,1 +1433,48 @@ 'use strict'

})
test('correctly handles no string headers', (t) => {
t.plan(2)
const dispatch = function (req, res) {
res.writeHead(200, { 'Content-Type': 'application/json' })
res.end(JSON.stringify(req.headers))
}
const date = new Date(0)
const headers = {
integer: 12,
float: 3.14,
null: null,
string: 'string',
object: { foo: 'bar' },
array: [1, 'two', 3],
date,
true: true,
false: false
}
inject(dispatch, { method: 'GET', url: 'http://example.com:8080/hello', headers }, (err, res) => {
t.error(err)
t.deepEqual(JSON.parse(res.payload), {
integer: '12',
float: '3.14',
null: 'null',
string: 'string',
object: '[object Object]',
array: '1,two,3',
date: date.toString(),
true: 'true',
false: 'false',
host: 'example.com:8080',
'user-agent': 'lightMyRequest'
})
})
})
test('errors for invalid undefined header value', (t) => {
t.plan(1)
try {
inject((req, res) => {}, { url: '/', headers: { 'header-key': undefined } }, () => {})
} catch (err) {
t.ok(err)
}
})
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