zend-frameworkzend-rest

How to change the Zend_Rest_Server response header 'zend' to "my_api"?


I use Zend Rest Server class to handle rest srvice:

 public function restAction() {
        $service = new Zend_Rest_Server();
        $service->setClass($this->_serviceClassName);
        $service->handle();
    }

In the Zend_Rest_Server the response header

<myApi generator="zend" version="1.0">

How to change the generator to different string?

Thanks Arman.


Solution

  • Well I found not so elegant solution but it works:

     $service->returnResponse(TRUE);
     $response = $service->handle();
    
     header('Content-Type: text/xml');
    
     // replace generator="zend" with my_app
     echo str_replace('generator="zend"', 'generator="my_app"', $response);