hftlclub / node-iltis

Node.js backend for ILTIS
MIT License
1 stars 0 forks source link

Send empty array with 200 instead of 204 #10

Closed fmalcher closed 7 years ago

fmalcher commented 7 years ago

For transfers and transactions an empty array would be much better than nothing and 204. if you go along with that, here's your TODO 😃 @rweisse

rweisse commented 7 years ago

@fmalcher Since yesterday every ressource which normally returns an array, will return a 204 statuscode if nothing is found. Should I change this everywhere? Or just for transfers and transactions?

fmalcher commented 7 years ago

Good question... can we find out what the best practice is? Empty array with status 200 would be great for me in the frontend. Otherwise I need to check for null and create an empty array then. Both ways work but havong this done in the backend would be a bit smarter.

fmalcher commented 7 years ago

Depends a bit of whether the empty result is intended or not. For transfers and transactions this is indeed intended, because it's possible (and wanted) that there are no transfers or transaction for an event.

However, in order to be consistent, I suggest using 200 + [] everywhere. Also see this thread for the same discussion: https://groups.google.com/forum/#!topic/api-craft/wngl_ZKONyk

rweisse commented 7 years ago

200 + [] is now used everywhere.