From 1a012a285c81bccd3820c78bae4e73d3c821a990 Mon Sep 17 00:00:00 2001 From: Allan Kimmer Jensen Date: Mon, 17 Feb 2025 12:15:17 +0100 Subject: [PATCH] chore: Replace parseurl with WHATWG URL API More information here: https://github.com/e18e/ecosystem-issues/issues/160 --- lib/express/mock-request.js | 3 +-- package-lock.json | 16 +--------------- package.json | 1 - 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/lib/express/mock-request.js b/lib/express/mock-request.js index 57b28f7..3f08c9a 100644 --- a/lib/express/mock-request.js +++ b/lib/express/mock-request.js @@ -1,7 +1,6 @@ const accepts = require('accepts'); const typeis = require('type-is'); const parseRange = require('range-parser'); -const parse = require('parseurl'); const { isIP } = require('net'); const fresh = require('fresh'); @@ -119,7 +118,7 @@ defineGetter(req, 'subdomains', function subdomains() { }); defineGetter(req, 'path', function path() { - return parse(this).pathname; + return new URL(this).pathname; }); defineGetter(req, 'hostname', function hostname() { diff --git a/package-lock.json b/package-lock.json index b198942..d3e170e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "node-mocks-http", - "version": "1.16.1", + "version": "1.16.2", "license": "MIT", "dependencies": { "accepts": "^1.3.7", @@ -16,7 +16,6 @@ "merge-descriptors": "^1.0.1", "methods": "^1.1.2", "mime": "^1.3.4", - "parseurl": "^1.3.3", "range-parser": "^1.2.0", "type-is": "^1.6.18" }, @@ -4893,14 +4892,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "engines": { - "node": ">= 0.8" - } - }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -9948,11 +9939,6 @@ "lines-and-columns": "^1.1.6" } }, - "parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" - }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", diff --git a/package.json b/package.json index 0d72425..cc64972 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "merge-descriptors": "^1.0.1", "methods": "^1.1.2", "mime": "^1.3.4", - "parseurl": "^1.3.3", "range-parser": "^1.2.0", "type-is": "^1.6.18" },