[HLRC] Throw an exception if an http warning is returned by the server #33598
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.
Currently the high level client silently ignores any warnings returned by the server. I stumbled on this when I deprecated a url parameter on the server side, forgot to change the high level rest client and still all client tests passed.
It is difficult to argue that any warning should result in an exception as the client does not have control over the request source provided by the user. But I think that it would be nice once a deprecated url parameter is used, the integration tests to fail (similar to the rest-api tests). What about introducing a strict
testmode
where any warning results in an exception? This way the used parameters and code snippets in the docs will be using always the 'correct' fields and url parameters.I am not sure if this is something ES team is interested in pursuing. Hence this PR is intended as a starting point for a discussion rather than a solution.
(a CI run of this PR will expectedly fail as the client is currently using a deprecated endpoint)