Skip to content

Commit 5559382

Browse files
aitboudadchristopherthielen
authored andcommitted
fix(BrowserLocationConfig): fixed protocol + port value (#38)
1 parent 64fbfff commit 5559382

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/vanilla/browserLocationConfig.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@ export class BrowserLocationConfig implements LocationConfig {
1414
constructor(router?, private _isHtml5 = false) { }
1515

1616
port(): number {
17-
return parseInt(location.port);
17+
if (location.port) {
18+
return Number(location.port);
19+
}
20+
21+
return this.protocol() === 'https' ? 443 : 80;
1822
}
1923

2024
protocol(): string {
21-
return location.protocol;
25+
return location.protocol.replace(/:/g, '');
2226
}
2327

2428
host(): string {

0 commit comments

Comments
 (0)