Skip to content

Commit

Permalink
fix: also return other protocols as lower-case
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Nov 15, 2023
1 parent ed23898 commit c6ebedc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function parseURL(input = "", defaultProto?: string): ParsedURL {
);

return {
protocol,
protocol: protocol.toLowerCase(),
auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
host,
pathname,
Expand Down
11 changes: 11 additions & 0 deletions test/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@ describe("parseURL", () => {
hash: "#owo",
},
},
{
input: "Https://domain.test:3000#owo",
out: {
protocol: "https:",
auth: "",
host: "domain.test:3000",
pathname: "",
search: "",
hash: "#owo",
},
},
{
input: "data:image/png;base64,aaa//bbbbbb/ccc",
out: {
Expand Down

0 comments on commit c6ebedc

Please sign in to comment.