From ad02b1784f9e040372f3ee9228064cdc6096dd84 Mon Sep 17 00:00:00 2001 From: Joel Alenchery Date: Thu, 24 Jun 2021 17:43:12 +0530 Subject: [PATCH 1/3] fix default parameter stripFragment in index --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index d7aadd5..31b2a04 100644 --- a/lib/index.js +++ b/lib/index.js @@ -39,7 +39,7 @@ function parseUrl(url, normalize = false) { if (normalize) { if (typeof normalize !== "object") { normalize = { - stripFragment: false + stripHash: false } } url = normalizeUrl(url, normalize) From 5135eeb317ac9023ae88206d4d548f09f4c191ec Mon Sep 17 00:00:00 2001 From: Joel Alenchery Date: Thu, 24 Jun 2021 17:44:09 +0530 Subject: [PATCH 2/3] fix default parameter stripFragment in test --- test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/index.js b/test/index.js index 159c904..0fd5372 100644 --- a/test/index.js +++ b/test/index.js @@ -80,7 +80,7 @@ tester.describe("check urls", test => { const res = parseUrl(url, c[0][1] !== false); if (c[0][1] !== false) { url = normalizeUrl(url, { - stripFragment: false + stripHash: false }) } c[1].query = qs.parse(c[1].search) From b035d225244e76361b9372edb3fd64f036fee2b7 Mon Sep 17 00:00:00 2001 From: Joel Alenchery Date: Thu, 24 Jun 2021 17:45:54 +0530 Subject: [PATCH 3/3] Add unit test for normalize:true case --- test/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/index.js b/test/index.js index 0fd5372..339af1f 100644 --- a/test/index.js +++ b/test/index.js @@ -71,6 +71,19 @@ const INPUTS = [ , search: "" } ] + , [ + ["http://ionicabizau.net/with-true-normalize", true] + , { + protocols: [ "http" ] + , protocol: "http" + , port: null + , resource: "ionicabizau.net" + , user: "" + , pathname: "/with-true-normalize" + , hash: "" + , search: "" + } + ] ]; tester.describe("check urls", test => {