-
Notifications
You must be signed in to change notification settings - Fork 24.7k
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
Using incorrect Accept/Content-Type headers in compatibility mode has bad client-side UX #78214
Comments
Pinging @elastic/es-core-infra (Team:Core/Infra) |
@sethpayne - The behavior of needing to setting both mime types the same value when both are sent is intentional. We don't want to allow a non-compatible request with a compatible response (or vice versa). The lack of a proper response is a bug. Thanks for finding that, and please let me know if ^^ does not make sense or causes difficulty in adoption. cc @pgomulka |
@jakelandis The behavior of requiring both to be set when in compatibility mode is fine for clients. Also I think you pinged Seth Payne on accident, the curse of multiple Seths on the same small team! |
RestCompatibleVersionHelper is used to validate versions on Accept and Content-Type headers When a validation fails, an exception is being thrown indicating which headers are incorrect. That exception was not handled in RestRequest where the helper was used. This commit gracefully handles the exception from validation failure. A bad request response is returned to a user. closes #79060 closes #78214
) RestCompatibleVersionHelper is used to validate versions on Accept and Content-Type headers When a validation fails, an exception is being thrown indicating which headers are incorrect. That exception was not handled in RestRequest where the helper was used. This commit gracefully handles the exception from validation failure. A bad request response is returned to a user. closes elastic#79060 closes elastic#78214
…80605) RestCompatibleVersionHelper is used to validate versions on Accept and Content-Type headers When a validation fails, an exception is being thrown indicating which headers are incorrect. That exception was not handled in RestRequest where the helper was used. This commit gracefully handles the exception from validation failure. A bad request response is returned to a user. closes #79060 closes #78214
Discovered this behavior when testing the compatibility mimetype (
application/vnd.elasticsearch+json?compatible-with=X
) being used withAccept
andContent-Type
. When using the compatibility mimetype in eitherAccept
orContent-Type
the other HTTP header if given must be set to the compatibility mimetype as well otherwise an error occurs.When running the following command:
The error message server-side in the logs is a good one, can tell exactly what's wrong:
but client-side this is what's returned:
Elasticsearch doesn't send an HTTP response and instead hangs up the socket. This isn't a great user-experience, perhaps this can be changed to Elasticsearch returning a 4XX HTTP response (maybe 400, 406, 415?) with the error message above?
The text was updated successfully, but these errors were encountered: