0

I need to make sure that several parameters are provided in my Zend_Rest_Controller.

Here is my code:

public function indexAction() {       
   $filters = array(
            'locid' => array('HtmlEntities', 'StringTrim')
            );

    $validators = array(
            'locid' => array('NotEmpty')
            );

    $input = new Zend_Filter_Input($filters, $validators);
    $input->setData($this->getRequest()->getParams());


    if($input->isValid())
    {
        echo "Correct";

    }
    else
    {
        echo "missing/invalid params";
    }
}

But if I supply the url formated like this (without query string):

localhost/ws

it returns 'Correct', instead of 'missing/invalid params'.

Any easy solution or parameters to include in validators?

Thanks.

menjaraz
  • 7,551
  • 4
  • 41
  • 81
VHanded
  • 2,079
  • 4
  • 30
  • 55

1 Answers1

0

I think that behavior is correct. The servername: 'localhost' in your case must be provided to call the actual validator