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 4.4.3 to 4.4.4

3

lib/parseURL.js

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

module.exports = function parseURL (url, query) {
if ((typeof url === 'string' || Object.prototype.toString.call(url) === '[object String]') && url.startsWith('//')) {
url = BASE_URL + url
}
const result = typeof url === 'object'

@@ -17,0 +20,0 @@ ? Object.assign(new URL(BASE_URL), url)

2

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

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

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

const formAutoContent = require('form-auto-content')
const httpMethods = [

@@ -1710,1 +1709,39 @@ 'delete',

})
test('value of request url when using inject should not differ', (t) => {
t.plan(1)
const server = http.createServer()
const dispatch = function (req, res) {
res.end(req.url)
}
inject(dispatch, { method: 'GET', url: 'http://example.com:8080//hello', server: server })
.then(res => { t.equal(res.body, '//hello') })
.catch(err => t.error(err))
})
test('Can parse paths with single leading slash', (t) => {
t.plan(1)
const parsedURL = parseURL('/test', undefined)
t.equal(parsedURL.href, 'http://localhost/test')
})
test('Can parse paths with two leading slashes', (t) => {
t.plan(1)
const parsedURL = parseURL('//test', undefined)
t.equal(parsedURL.href, 'http://localhost//test')
})
test('Can parse URLs with two leading slashes', (t) => {
t.plan(1)
const parsedURL = parseURL('https://example.com//test', undefined)
t.equal(parsedURL.href, 'https://example.com//test')
})
test('Can parse URLs with single leading slash', (t) => {
t.plan(1)
const parsedURL = parseURL('https://example.com/test', undefined)
t.equal(parsedURL.href, 'https://example.com/test')
})
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