I wrote a web API that returns 204 (No Content) when a client requests all elements on a collection but the collection is empty.
For example: /api/products
returns 204 when there are no products.
Now my problem is that I'm trying to consume the API using Restangular like this:
Restangular.all('products').getList().then(function (products) {
$scope.products = products;
});
However this results in the following javascript error.
Error: Response for getList SHOULD be an array and not an object or something else
What gives? I can't find any information on handling no content in the Restangular doc
Am I using 204 wrong? Should I instead return 200 with an empty list?