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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow parsing Content-Type and Accept headers with version #61427
Allow parsing Content-Type and Accept headers with version #61427
Changes from all commits
7514d87
921bc6f
ee280ba
433de74
51467e0
ccaadbd
de13d4b
d9ee420
41150a6
2fc8f86
734031a
c04af65
474eb29
5c30813
7b760ba
5853561
b6ebd63
ff6c94f
b969f2b
0684e58
b91d472
9edc49f
c5d8166
ad673b6
1ae6a60
1ae63c6
ee1e5a0
9f4b6c3
bd4dee1
ce42f1b
0f8ae7b
c4f02ad
176302e
eab471c
e128fd7
66435dd
08f1395
3f3f0d5
427c391
e031605
4134d92
a976f5b
3e0eec0
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the discussion:
defining versioned media types up front, means that we won't throw an exception if someone specifies it with oss licence
if he uses oss on v8 server for api that was removed and provides
application/vnd.elasticsearch+json;compatible-with=7
he will get a 404is there an easy way to make
XContentType
plugin aware? or licence aware?or are we ok with allowing to use versioned media types with oss?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a 404 (or maybe 400) is the right thing to do here since the infrastructure for version support is in OSS and we do not have a compatible handler for V7.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but this also would affect plugins like SQL. In oss we don't know about MediaTypes which are defined over there
if we throw an exception for a unknown type I am worried we might end up with a logic based on exceptions
@bpintea any thoughts on this? I guess SQL had to face this in the past
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way to register a custom parser ? or just add the SQL values to the core parser and specificy which rule set to use when parsing ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is an interesting idea.. We could have something like a SqlMediaTypeParser and it would either return TextFormat or XContentType. The parsing logic would remain the same in the MediaTypeParser. The idea of SqlMediaTypeParser woudl be just to abstract on the setup of the parser.
The same could be done for CompatibleApiMediaTypeParser and we could keep it in xpack plugin.
this does not solve the problem of trying to parse a format, then if failed to parse a media type. I think we should try to just check for presence of the format parameter and if present to used. Otherwise trying to use Accept Header.
I think also that Content-Type should not be used for response formatting in SQL plugin. It looks like it is allowed in code, but I don't think it would work (it would fail when parsing that header in server)