-
Notifications
You must be signed in to change notification settings - Fork 2
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
Some revisions to the idea of using a function #21
Some revisions to the idea of using a function #21
Conversation
Pattern.CASE_INSENSITIVE); | ||
|
||
@Override | ||
public Version getCompatibleVersion(@Nullable String acceptHeader, @Nullable String contentTypeHeader) { |
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.
it does look better than the logic we had before. Lack of hasContent() makes it look cleaner, but makes the validation less strict. I will add previous test cases to verify
"Accept=%s Content-Type=%s", acceptHeader, | ||
contentTypeHeader)); | ||
} | ||
return Version.fromString(Version.CURRENT.major - 1 + ".0.0"); |
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 we might be missing previous test case when someone is using a compatible api but his client is not sending accept and content-type headers. Looks like it is possible ?
|
||
public RestController(Set<RestHeaderDefinition> headersToCopy, UnaryOperator<RestHandler> handlerWrapper, | ||
NodeClient client, CircuitBreakerService circuitBreakerService, UsageService usageService, | ||
BiFunction<Map<String, List<String>>, Boolean, Boolean> isRestCompatibleFunction) { | ||
BiFunction<String, String, Version> restCompatibleFunction) { |
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.
This BiFunction and just types makes me worried that this will become less readable.
I wonder if we can create an interface for it. Will give it a go
No description provided.