mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Support Kibana URL parts with stripped default port (#197418)
## Summary This PR adds support for getting Kibana URL parts with stripped default port. ### Details * Adds method `getUrlPartsWithStrippedDefaultPort` to `kbnTestConfig` * Can be used when asserting URLs where the browser strips the default port
This commit is contained in:
parent
5adb0ea5d2
commit
629edc03da
1 changed files with 17 additions and 0 deletions
|
@ -54,4 +54,21 @@ export const kbnTestConfig = new (class KbnTestConfig {
|
|||
password,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Use to get `port:undefined` for assertions if the port is default for the
|
||||
* used protocol and thus would be stripped by the browser
|
||||
*/
|
||||
getUrlPartsWithStrippedDefaultPort(user: UserAuth = kibanaTestUser): UrlParts {
|
||||
const urlParts = this.getUrlParts(user);
|
||||
|
||||
if (
|
||||
(urlParts.protocol === 'http' && urlParts.port === 80) ||
|
||||
(urlParts.protocol === 'https' && urlParts.port === 443)
|
||||
) {
|
||||
urlParts.port = undefined;
|
||||
}
|
||||
|
||||
return urlParts;
|
||||
}
|
||||
})();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue