drahak / Restful

Drahak\Restful - Nette REST API bundle
0 stars 0 forks source link

204 No Content #97

Open ondrej-tuhacek opened 8 years ago

ondrej-tuhacek commented 8 years ago

Is it somehow possible not to sending HTTP 204 No content header when an empty array is passed into $this->resource? I would like to have output like [] in JSON (We use Kendo UI and these components expect empty JSON collection when nothing is filtered out in autocomplete input).

jspetrak commented 8 years ago

I've just hit the same problem. Though both HTTP 200 OK + [] and HTTP 204 No Content responses are valid, the later provides benefit of having single if-else check in the client code and iteration of result regardles of number of items returned.