Skip to content

Commit af36bd5

Browse files
fix: use startsWith for protocol matching in parseUrl
closes #842
1 parent b61bfc2 commit af36bd5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib/parse-url.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function parseUrl (url) {
1313
if (!url) { url = `${defaultHost}${defaultPath}` }
1414

1515
// Default to HTTPS if no protocol explictly specified
16-
const protocol = url.match(/^http?:\/\//) ? 'http' : 'https'
16+
const protocol = url.startsWith("http:") ? "http" : "https"
1717

1818
// Normalize URLs by stripping protocol and no trailing slash
1919
url = url.replace(/^https?:\/\//, '').replace(/\/$/, '')

0 commit comments

Comments
 (0)