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
9
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 5.6.1 to 5.7.0

3

lib/response.js

@@ -142,5 +142,2 @@ 'use strict'

res.json = function parseJsonPayload () {
if (res.headers['content-type'].indexOf('application/json') < 0) {
throw new Error('The content-type of the response is not application/json')
}
return JSON.parse(res.payload)

@@ -147,0 +144,0 @@ }

6

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

@@ -19,3 +19,3 @@ "main": "index.js",

"express": "^4.17.1",
"form-auto-content": "^2.0.0",
"form-auto-content": "^3.0.0",
"form-data": "^4.0.0",

@@ -25,3 +25,3 @@ "semver": "^7.3.5",

"tap": "^16.0.0",
"tsd": "^0.23.0"
"tsd": "^0.24.1"
},

@@ -28,0 +28,0 @@ "scripts": {

@@ -184,3 +184,3 @@ # Light my Request

- `trailers` - an object containing the response trailers.
- `json` - a function that parses the `application/json` response payload and returns an object. Throws if the content type does not contain `application/json`.
- `json` - a function that parses a json response payload and returns an object.
- `cookies` - a getter that parses the `set-cookie` response header and returns an array with all the cookies and their metadata.

@@ -187,0 +187,0 @@

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

test('Response.json() should throw an error if content-type is not application/json', (t) => {
test('Response.json() should not throw an error if content-type is not application/json', (t) => {
t.plan(2)
const json = {
const jsonData = {
a: 1,

@@ -1435,3 +1435,3 @@ b: '2'

res.writeHead(200, { 'Content-Type': 'text/plain' })
res.end(JSON.stringify(json))
res.end(JSON.stringify(jsonData))
}

@@ -1441,3 +1441,4 @@

t.error(err)
t.throws(res.json, Error)
const { json } = res
t.same(json(), jsonData)
})

@@ -1444,0 +1445,0 @@ })

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