[Http] Make HTTP resource routes respond without the versioned header#195940
Merged
jloleysens merged 18 commits intoelastic:mainfrom Oct 15, 2024
Merged
[Http] Make HTTP resource routes respond without the versioned header#195940jloleysens merged 18 commits intoelastic:mainfrom
jloleysens merged 18 commits intoelastic:mainfrom
Conversation
jloleysens
commented
Oct 11, 2024
Contributor
Author
|
/ci |
jloleysens
commented
Oct 11, 2024
|
|
||
| await root.start(); | ||
| const { header } = await request.get(root, '/render-html').expect(200); | ||
| expect(header).not.toMatchObject({ 'elastic-api-version': expect.any(String) }); |
Contributor
Author
There was a problem hiding this comment.
Making this test work is the main focus of the PR.
Contributor
Author
|
/ci |
Contributor
Author
|
/ci |
Contributor
|
Pinging @elastic/kibana-core (Team:Core) |
Contributor
|
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/11347866493 |
Contributor
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]History
cc @jloleysens |
kibanamachine
added a commit
to kibanamachine/kibana
that referenced
this pull request
Oct 15, 2024
…elastic#195940) ## Summary Follow up on elastic#195464 Adds public route registrar option `httpResource` to distinguish API routes from routes intended to be used for loading resources, [for ex](https://github.com/elastic/kibana/blob/bd22f1370fc55179ea6f2737176570176f700b6e/x-pack/plugins/security/server/routes/authentication/oidc.ts#L36). This enables us to avoid returning the version header `elastic-api-version` for HTTP resource routes. It's still possible for API authors to use the versioned router for things that should be HTTP resources, but it's assumed that all routes registered through HTTP resources services are: 1. Public 2. Not versioned (focus of this PR) 3. Not documented (done in elastic#192675) ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 72f3d2d)
Contributor
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
kibanamachine
added a commit
that referenced
this pull request
Oct 15, 2024
…header (#195940) (#196324) # Backport This will backport the following commits from `main` to `8.x`: - [[Http] Make HTTP resource routes respond without the versioned header (#195940)](#195940) <!--- 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-15T14:09:42Z","message":"[Http] Make HTTP resource routes respond without the versioned header (#195940)\n\n## Summary\r\n\r\nFollow up on https://github.com/elastic/kibana/pull/195464\r\n\r\nAdds public route registrar option `httpResource` to distinguish API\r\nroutes from routes intended to be used for loading resources, [for\r\nex](https://github.com/elastic/kibana/blob/bd22f1370fc55179ea6f2737176570176f700b6e/x-pack/plugins/security/server/routes/authentication/oidc.ts#L36).\r\n\r\nThis enables us to avoid returning the version header\r\n`elastic-api-version` for HTTP resource routes.\r\n\r\nIt's still possible for API authors to use the versioned router for\r\nthings that should be HTTP resources, but it's assumed that all routes\r\nregistered through HTTP resources services are:\r\n\r\n1. Public\r\n2. Not versioned (focus of this PR)\r\n3. Not documented (done in\r\nhttps://github.com//pull/192675)\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"72f3d2d3491f6da4b0c9147e766635e9dbb9cbe8","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] Make HTTP resource routes respond without the versioned header","number":195940,"url":"https://github.com/elastic/kibana/pull/195940","mergeCommit":{"message":"[Http] Make HTTP resource routes respond without the versioned header (#195940)\n\n## Summary\r\n\r\nFollow up on https://github.com/elastic/kibana/pull/195464\r\n\r\nAdds public route registrar option `httpResource` to distinguish API\r\nroutes from routes intended to be used for loading resources, [for\r\nex](https://github.com/elastic/kibana/blob/bd22f1370fc55179ea6f2737176570176f700b6e/x-pack/plugins/security/server/routes/authentication/oidc.ts#L36).\r\n\r\nThis enables us to avoid returning the version header\r\n`elastic-api-version` for HTTP resource routes.\r\n\r\nIt's still possible for API authors to use the versioned router for\r\nthings that should be HTTP resources, but it's assumed that all routes\r\nregistered through HTTP resources services are:\r\n\r\n1. Public\r\n2. Not versioned (focus of this PR)\r\n3. Not documented (done in\r\nhttps://github.com//pull/192675)\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"72f3d2d3491f6da4b0c9147e766635e9dbb9cbe8"}},"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/195940","number":195940,"mergeCommit":{"message":"[Http] Make HTTP resource routes respond without the versioned header (#195940)\n\n## Summary\r\n\r\nFollow up on https://github.com/elastic/kibana/pull/195464\r\n\r\nAdds public route registrar option `httpResource` to distinguish API\r\nroutes from routes intended to be used for loading resources, [for\r\nex](https://github.com/elastic/kibana/blob/bd22f1370fc55179ea6f2737176570176f700b6e/x-pack/plugins/security/server/routes/authentication/oidc.ts#L36).\r\n\r\nThis enables us to avoid returning the version header\r\n`elastic-api-version` for HTTP resource routes.\r\n\r\nIt's still possible for API authors to use the versioned router for\r\nthings that should be HTTP resources, but it's assumed that all routes\r\nregistered through HTTP resources services are:\r\n\r\n1. Public\r\n2. Not versioned (focus of this PR)\r\n3. Not documented (done in\r\nhttps://github.com//pull/192675)\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"72f3d2d3491f6da4b0c9147e766635e9dbb9cbe8"}},{"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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow up on #195464
Adds public route registrar option
httpResourceto distinguish API routes from routes intended to be used for loading resources, for ex.This enables us to avoid returning the version header
elastic-api-versionfor HTTP resource routes.It's still possible for API authors to use the versioned router for things that should be HTTP resources, but it's assumed that all routes registered through HTTP resources services are:
Checklist