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
When requesting an unallowed state transition on a document on the CRUD service (ie: from PUBLIC to DELETED) the CRUD service responds with a 404 NOT FOUND status code and the following response body:
{
"error": "not found"
}
However, I find this response not helpful, as it is the same that is returned when the document is not found. I believe that the appropriate response would be a 400 BAD REQUEST with a response body similar to something like this:
{
"error": "transitions from state 'PUBLIC' to 'DELETED' are not allowed"
}
Environment
I'm using CRUD Service version 4.0.0, but I suspect that this issue is also relevant for newer versions
Minimal Reproduction
Create a document with __STATE__ set to PUBLIC
Request a state change by performing a POST request to /your-collection/your-document-id/state with the request body set to:
{"stateTo":"DELETED"}
Observe the returned response status code
The text was updated successfully, but these errors were encountered:
I would not consider this a bug, but rather an enhancement of the interface. We can work on it to improve CRUD Service interface, but let's keep in mind that it will be a breaking change, since CRUD Service users may have built a logic considering the current HTTP response.
Description
When requesting an unallowed state transition on a document on the CRUD service (ie: from
PUBLIC
toDELETED
) the CRUD service responds with a404 NOT FOUND
status code and the following response body:However, I find this response not helpful, as it is the same that is returned when the document is not found. I believe that the appropriate response would be a
400 BAD REQUEST
with a response body similar to something like this:Environment
I'm using CRUD Service version 4.0.0, but I suspect that this issue is also relevant for newer versions
Minimal Reproduction
__STATE__
set toPUBLIC
/your-collection/your-document-id/state
with the request body set to:The text was updated successfully, but these errors were encountered: