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 BaseRestHandler includes a check whether content (the REST body) has been consumed by an API, throwing an exception here if it does not do so. This exception is tested in OpenSearch in a few places and we relied on it here for multiple APIs:
Get Workflow
Delete Workflow
Get Workflow State
Deprovision Workflow
Get Workflow Step
The reason for this check was that including a body would still execute the requested action but then fail to provide a proper REST result to the user. For the Get APIs this was mostly harmless, but deleting or deprovisioning a workflow would have side effects not reported to the user.
Unfortunately, it appears that these unit tests which rely on the behavior of the BaseRestHandler do not take into account the fact that the RestController always consumes content here when a REST request arrives via the HTTP handler.
How can one reproduce the bug?
Query any of the above APIs with a body in the request, for example
As intended: a 400 response with the message "request [GET /_plugins/_flow_framework/workflow/{workflow_id}] does not support having a body"
As implemented elsewhere in OpenSearch: silently ignored
Do you have any additional context?
This behavior has existed for at least 5 years but is undocumented/confusing. I'll be submitting a bug on the OpenSearch side reporting this, but the ideal fix (not consuming content) would potentially be seriously backwards incompatble with many scripts developed in the past 5 years.
In the meantime, we should not be sending null back to the Base Rest Handler.
The text was updated successfully, but these errors were encountered:
What is the bug?
The
BaseRestHandler
includes a check whether content (the REST body) has been consumed by an API, throwing an exception here if it does not do so. This exception is tested in OpenSearch in a few places and we relied on it here for multiple APIs:The reason for this check was that including a body would still execute the requested action but then fail to provide a proper REST result to the user. For the Get APIs this was mostly harmless, but deleting or deprovisioning a workflow would have side effects not reported to the user.
Unfortunately, it appears that these unit tests which rely on the behavior of the
BaseRestHandler
do not take into account the fact that theRestController
always consumes content here when a REST request arrives via the HTTP handler.How can one reproduce the bug?
Query any of the above APIs with a body in the request, for example
localhost:9200/_plugins/_flow_framework/workflow/any_id_here {}
The result is:
What is the expected behavior?
As intended: a 400 response with the message "request [GET /_plugins/_flow_framework/workflow/{workflow_id}] does not support having a body"
As implemented elsewhere in OpenSearch: silently ignored
Do you have any additional context?
This behavior has existed for at least 5 years but is undocumented/confusing. I'll be submitting a bug on the OpenSearch side reporting this, but the ideal fix (not consuming content) would potentially be seriously backwards incompatble with many scripts developed in the past 5 years.
In the meantime, we should not be sending
null
back to the Base Rest Handler.The text was updated successfully, but these errors were encountered: