mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
# Backport This will backport the following commits from `main` to `8.16`: - [Support Kibana URL parts with stripped default port (#197418)](https://github.com/elastic/kibana/pull/197418) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Robert Oskamp","email":"robert.oskamp@elastic.co"},"sourceCommit":{"committedDate":"2024-10-23T15:11:22Z","message":"Support Kibana URL parts with stripped default port (#197418)\n\n## Summary\r\n\r\nThis PR adds support for getting Kibana URL parts with stripped default\r\nport.\r\n\r\n### Details\r\n\r\n* Adds method `getUrlPartsWithStrippedDefaultPort` to `kbnTestConfig`\r\n* Can be used when asserting URLs where the browser strips the default\r\nport","sha":"629edc03da0c91df34b101098d822436a6682f1a","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","v8.16.0","backport:version"],"title":"Support Kibana URL parts with stripped default port","number":197418,"url":"https://github.com/elastic/kibana/pull/197418","mergeCommit":{"message":"Support Kibana URL parts with stripped default port (#197418)\n\n## Summary\r\n\r\nThis PR adds support for getting Kibana URL parts with stripped default\r\nport.\r\n\r\n### Details\r\n\r\n* Adds method `getUrlPartsWithStrippedDefaultPort` to `kbnTestConfig`\r\n* Can be used when asserting URLs where the browser strips the default\r\nport","sha":"629edc03da0c91df34b101098d822436a6682f1a"}},"sourceBranch":"main","suggestedTargetBranches":["8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197418","number":197418,"mergeCommit":{"message":"Support Kibana URL parts with stripped default port (#197418)\n\n## Summary\r\n\r\nThis PR adds support for getting Kibana URL parts with stripped default\r\nport.\r\n\r\n### Details\r\n\r\n* Adds method `getUrlPartsWithStrippedDefaultPort` to `kbnTestConfig`\r\n* Can be used when asserting URLs where the browser strips the default\r\nport","sha":"629edc03da0c91df34b101098d822436a6682f1a"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Robert Oskamp <robert.oskamp@elastic.co>
This commit is contained in:
parent
34db454e06
commit
f6f8d802c1
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