Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
REST Controller passing empty array to response results in a 404
  • Hi all, I have just recently come across Fuel and loving it so far, but I have hit a snag. Using the Rest controller, I am sending model array data to the response e.g. <code>
    public function get_my_function()
    {
    $this->response( Model_Mymodel::search(Input::get('myvar')));
    }
    </code> When the array returned from the model is empty, I get a 404 error. I checked by hard coding in an empty array <code>
    public function get_my_function()
    {
    $this->response(array());
    }
    </code> Am I missing something? thanks Jarrod (from Australia)
  • No, you're not missing something. In the 1.1 release codebase that was the behaviour. In 1.1/develop, it now returns a 'no_data' status, which by default is set to 204. In both cases, an empty reponse is considered 'no data'. So you should check the http status after the call.
  • Thanks for you help WanWizard.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion