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.0 to 3.6.1

20

index.js

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

const errorMessage = 'The dispatch function has already been invoked'
const urlSchema = {

@@ -103,3 +104,8 @@ oneOf: [

function Chain (dispatch, option) {
this.option = Object.assign({}, option)
if (typeof option === 'string') {
this.option = { url: option }
} else {
this.option = Object.assign({}, option)
}
this.dispatch = dispatch

@@ -124,3 +130,3 @@ this._hasInvoked = false

if (this._hasInvoked === true || this._promise) {
throwIfAlreadyInvoked()
throw new Error(errorMessage)
}

@@ -143,3 +149,3 @@ this.option.url = url

if (this._hasInvoked === true || this._promise) {
throwIfAlreadyInvoked()
throw new Error(errorMessage)
}

@@ -153,3 +159,3 @@ this.option[method] = value

if (this._hasInvoked === true || this._promise) {
throwIfAlreadyInvoked()
throw new Error(errorMessage)
}

@@ -170,3 +176,3 @@ this._hasInvoked = true

if (this._hasInvoked === true) {
throwIfAlreadyInvoked()
throw new Error(errorMessage)
}

@@ -186,7 +192,3 @@ this._promise = doInject(this.dispatch, this.option)

function throwIfAlreadyInvoked () {
throw new Error('The dispatch function has already been invoked')
}
module.exports = inject
module.exports.isInjection = isInjection
{
"name": "light-my-request",
"version": "3.6.0",
"version": "3.6.1",
"description": "Fake HTTP injection library",

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

@@ -1201,2 +1201,16 @@ 'use strict'

test('chainable api: string url', (t) => {
t.plan(2)
function dispatch (req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' })
res.end()
t.pass()
}
const chain = inject(dispatch, 'http://example.com:8080/hello')
chain.then(() => t.pass())
})
test('Response.json() should parse the JSON payload', (t) => {

@@ -1203,0 +1217,0 @@ t.plan(2)

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