Skip to content
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

Merged

Conversation

jakelandis
Copy link

No description provided.

Pattern.CASE_INSENSITIVE);

@Override
public Version getCompatibleVersion(@Nullable String acceptHeader, @Nullable String contentTypeHeader) {
Copy link
Owner

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");
Copy link
Owner

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) {
Copy link
Owner

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

@pgomulka pgomulka merged commit 72d7b13 into pgomulka:xpack-spi-request Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants