Skip to content

Some revisions to the idea of using a function#21

Merged
pgomulka merged 3 commits intopgomulka:xpack-spi-requestfrom
jakelandis:jake-xpack-spi-request
Jul 29, 2020
Merged

Some revisions to the idea of using a function#21
pgomulka merged 3 commits intopgomulka:xpack-spi-requestfrom
jakelandis:jake-xpack-spi-request

Conversation

@jakelandis
Copy link
Copy Markdown

No description provided.

Pattern.CASE_INSENSITIVE);

@Override
public Version getCompatibleVersion(@Nullable String acceptHeader, @Nullable String contentTypeHeader) {
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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