You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The OpenSearch BaseRestHandler throws an exception if content (the request body) is not consumed (request.content() is never called).
This creates a confusing situation in our code which doesn't require a body such as the provision and status APIs. Our code does throw an exception if there's no body, but the exception message we write is ignored and replaced by the BaseRestHandler's boilerplate.
What solution would you like?
One of the following:
Inside the existing hasContent() checks, consume the content (call request.content()) to preserve our own error message, and throw a useful error message.
Throw an empty exception without an error message that will be ignored to the existing catch block, and don't read the message there either.
Immediately return from the method without bothering with exceptions.
Do you have any additional context?
We do need to check the content existence somehow (as we do), otherwise we'll actually perform the user's requested action but swallow the response message with a useless error.
The text was updated successfully, but these errors were encountered:
dbwiddis
changed the title
[FEATURE] Ignore empty request body instead of failing
[FEATURE] Be more clear on exception for empty request body
Dec 11, 2023
Is your feature request related to a problem?
The OpenSearch
BaseRestHandler
throws an exception if content (the request body) is not consumed (request.content()
is never called).This creates a confusing situation in our code which doesn't require a body such as the provision and status APIs. Our code does throw an exception if there's no body, but the exception message we write is ignored and replaced by the BaseRestHandler's boilerplate.
What solution would you like?
One of the following:
hasContent()
checks, consume the content (callrequest.content()
) to preserve our own error message, and throw a useful error message.Do you have any additional context?
We do need to check the content existence somehow (as we do), otherwise we'll actually perform the user's requested action but swallow the response message with a useless error.
The text was updated successfully, but these errors were encountered: