[8.x] [HTTP] Copy array returned by `getRoutes` (#195647) (#195714)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[HTTP] Copy array returned by `getRoutes`
(#195647)](https://github.com/elastic/kibana/pull/195647)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Jean-Louis
Leysens","email":"jeanlouis.leysens@elastic.co"},"sourceCommit":{"committedDate":"2024-10-10T08:53:59Z","message":"[HTTP]
Copy array returned by `getRoutes` (#195647)\n\n## Summary\r\n\r\nSmall
follow up based
on\r\nhttps://github.com/elastic/kibana/pull/192675#discussion_r1793601519","sha":"a481da68e58cb20d6407c9866c1511717addfdb0","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:http","Team:Core","release_note:skip","v9.0.0","v8.16.0","backport:version"],"title":"[HTTP]
Copy array returned by
`getRoutes`","number":195647,"url":"https://github.com/elastic/kibana/pull/195647","mergeCommit":{"message":"[HTTP]
Copy array returned by `getRoutes` (#195647)\n\n## Summary\r\n\r\nSmall
follow up based
on\r\nhttps://github.com/elastic/kibana/pull/192675#discussion_r1793601519","sha":"a481da68e58cb20d6407c9866c1511717addfdb0"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195647","number":195647,"mergeCommit":{"message":"[HTTP]
Copy array returned by `getRoutes` (#195647)\n\n## Summary\r\n\r\nSmall
follow up based
on\r\nhttps://github.com/elastic/kibana/pull/192675#discussion_r1793601519","sha":"a481da68e58cb20d6407c9866c1511717addfdb0"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Jean-Louis Leysens <jeanlouis.leysens@elastic.co>
This commit is contained in:
Kibana Machine 2024-10-10 21:58:28 +11:00 committed by GitHub
parent 2a40e117ea
commit 8bd34c49e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -240,7 +240,7 @@ export class Router<Context extends RequestHandlerContextBase = RequestHandlerCo
if (excludeVersionedRoutes) {
return this.routes.filter((route) => !route.isVersioned);
}
return this.routes;
return [...this.routes];
}
public handleLegacyErrors = wrapErrors;