Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix normalize url default options #27

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/index.js
Expand Up @@ -39,7 +39,7 @@ function parseUrl(url, normalize = false) {
if (normalize) {
if (typeof normalize !== "object") {
normalize = {
stripFragment: false
stripHash: false
}
}
url = normalizeUrl(url, normalize)
Expand Down
15 changes: 14 additions & 1 deletion test/index.js
Expand Up @@ -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 => {
Expand All @@ -80,7 +93,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)
Expand Down