Allow passing versioned media types to 7.x server#63071
Merged
pgomulka merged 2 commits intoelastic:7.xfrom Oct 2, 2020
Merged
Allow passing versioned media types to 7.x server#63071pgomulka merged 2 commits intoelastic:7.xfrom
pgomulka merged 2 commits intoelastic:7.xfrom
Conversation
7.x client can pass media type with a version which will return a 7.x version of the api in ES 8. In ES server 7 this media type shoulld be accepted but it serve the same version of the API (7x)
Collaborator
|
Pinging @elastic/es-core-infra (:Core/Infra/REST API) |
Contributor
Author
|
@elasticmachine run elasticsearch-ci/2 |
jakelandis
reviewed
Sep 30, 2020
| * | ||
| * @return a media type string without | ||
| */ | ||
| private static String removeVersionInMediaType(String mediaType) { |
Contributor
There was a problem hiding this comment.
I would suggest to wrap this in if(mediaType.contains("vnd.elasticsearch"){ ...} else return mediaType. It is a micro-optimization, but will probably save a few CPU cycles. Also I think you can collapse the two replaceAll into a single line.
jakelandis
approved these changes
Sep 30, 2020
Contributor
jakelandis
left a comment
There was a problem hiding this comment.
LGTM, 1 minor optional comment
pgomulka
added a commit
to pgomulka/elasticsearch
that referenced
this pull request
Nov 23, 2020
a follow up after elastic#63071 where it missed the XContentType.fromMediaType method. That method also have to remove the vendor specific substrings (vnd.elasticsearch+ and compatible-with parameter) from mediaType value relates elastic#51816
pgomulka
added a commit
that referenced
this pull request
Nov 25, 2020
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.
7.x client can pass media type with a version which will return a 7.x
version of the api in ES 8.
In ES server 7 this media type shoulld be accepted but it serve the same
version of the API (7x)
relates #51816