Skip to content

Commit 75a280c

Browse files
committed
fix: port should be string
reverts 325cb8b
1 parent 9741e57 commit 75a280c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/parse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface ParsedAuth {
1616

1717
export interface ParsedHost {
1818
hostname: string;
19-
port: number;
19+
port: string;
2020
}
2121

2222
export function parseURL(input = "", defaultProto?: string): ParsedURL {
@@ -68,7 +68,7 @@ export function parseHost(input = ""): ParsedHost {
6868
const [hostname, port] = (input.match(/([^/:]*):?(\d+)?/) || []).splice(1);
6969
return {
7070
hostname: decode(hostname),
71-
port: port ? Number.parseInt(port) : undefined,
71+
port,
7272
};
7373
}
7474

test/parse.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ describe("parseURL", () => {
9292

9393
describe("parseHost", () => {
9494
const tests = [
95-
{ input: "localhost:3000", out: { hostname: "localhost", port: 3000 } },
95+
{ input: "localhost:3000", out: { hostname: "localhost", port: "3000" } },
9696
{ input: "google.com", out: { hostname: "google.com", port: undefined } },
9797
];
9898

0 commit comments

Comments
 (0)