-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Rest Controller wildcard registration #46487
Rest Controller wildcard registration #46487
Conversation
Registering two different http methods on the same path using different wildcard names would result in the last wildcard name being active only. Now throw an exception instead. Closes elastic#46482
Pinging @elastic/es-core-infra |
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.
LGTM I left one comment about the test
IllegalArgumentException exception = expectThrows(IllegalArgumentException.class, | ||
() -> restController.registerHandler(secondMethod, path + "/{wildcard2}", handler)); | ||
|
||
assertThat(exception.getMessage(), containsString("wildcard1")); |
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 since we know the exact exception text that it would be good to check it here, otherwise it's possible a different exception in the future could be thrown but this test wouldn't break.
Something like:
assertThat(exception.getMessage(), equalTo("Trying to use conflicting wildcard names for same path: wildcard1 and wildcard2"))
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.
Fixed in 3164595
Thanks for reviewing @dakrone |
@elasticmachine run elasticsearch-ci/packaging-sample |
Registering two different http methods on the same path using different wildcard names would result in the last wildcard name being active only. Now throw an exception instead. Closes #46482
Registering two different http methods on the same path using different
wildcard names would result in the last wildcard name being active only.
Now throw an exception instead.
Closes #46482