**Informations
What is the current behavior?
When I run a count request with filters, and the expected resoult is greater equal than 1, It responses is the correct number, but when should respond with a 0, I get a 404
Steps to reproduce the problem
Create some entity, fill some data, and run a count request with some filters
For example I have my invoice entity
With this data
The "found something count" works great
but the "should return 0" returns a 404
What is the expected behavior?
Is this a bug or a feature? When the count ammount is 0, I think it should return a 0, its more accurate than a 404
related with https://github.com/strapi/strapi/issues/1344 maybe?
@guillermodoghel unlikely related to my issue there. The count service likely doesn't have a catch setup. Much like a GET request returns an empty json array, the count doesn't get a response from the db on data and defaults to a 404 error.
Your right that it should return a 0. (Technically speaking this should be a 500 error if anything lol, 4xx is a user problem. So regardless it shouldn't be a 404)
I can confirm this bug exists though.
There is somewhere (haha) in the code where we check if the body is empty or not to set 404 response. We have to omit 0
as body to not send 404 response.
The thing you have to do is to find where the test is made :shipit:
@lauriejim are you working on this? I could have a look and raise a PR later today if you haven't started yet. 馃
Most helpful comment
@guillermodoghel unlikely related to my issue there. The count service likely doesn't have a catch setup. Much like a GET request returns an empty json array, the count doesn't get a response from the db on data and defaults to a 404 error.
Your right that it should return a 0. (Technically speaking this should be a 500 error if anything lol, 4xx is a user problem. So regardless it shouldn't be a 404)
I can confirm this bug exists though.