Zend Framework REST service HTTP status code problem

Posted by Baversjo on Stack Overflow See other posts from Stack Overflow or by Baversjo
Published on 2010-04-05T10:59:37Z Indexed on 2010/04/05 11:03 UTC
Read the original article Hit count: 363

I'm trying to create a REST service in zend framework. I'm using zend server.

Here's my code:

class ArticleController extends Zend_Rest_Controller
{
  public function postAction()
  {
    //Create the acticle and return it
    $data = array("foo" => 0, "boo" => 11);
    $this->getResponse()->setHttpResponseCode(201);
    $this->_helper->json($data);
  }

The HTTP response returns the appropriate headers and JSON data but under the JSON data there's an apache error document. The only way I can think of to remove the appended error document is to add the following in my httpd.conf file:

ErrorDocument 201 " "

But what's the "corrent" way of doing this?

© Stack Overflow or respective owner

Related posts about apache

Related posts about php