/** * The default indexAction to Agana's Rest controllers should not be called * returning a Bad Request. * The indexAction may be implemented when is needed a Rest and Tradicional controller */ public function indexAction() { $codeReturn = Agana_Http_StatusCodes::HTTP_BAD_REQUEST; $this->getResponse()->setHttpResponseCode($codeReturn); $this->getResponse()->setHeader('Message', Agana_Http_StatusCodes::getMessageForCode($codeReturn, true)); $this->getResponse()->setBody('You should not access this service without a proper HTTP HEADER'); }
public function getAction() { $response = $this->getResponse(); $this->_helper->viewRenderer->setNoRender(true); $layout = Zend_Layout::getMvcInstance(); $layout->disableLayout(); if ($image = $this->_getImage()) { $domain = new Media_Domain_Image(); $domain->setImage($image); $response->setHeader('Content-Type', $image->getMimetype()); $size = $this->_hasParam('size') ? $this->_getParam('size') : ''; $img = $domain->loadFile($size); $response->setBody($img); } else { $response->setHttpResponseCode(Agana_Http_StatusCodes::HTTP_NOT_FOUND); $response->setBody(Agana_Http_StatusCodes::getMessageForCode(Agana_Http_StatusCodes::HTTP_NOT_FOUND)); } }
/** * @todo Implement testIsError(). */ public function testIsError() { $this->assertFalse($this->object->isError(300), 'Should nor be an error'); $this->assertTrue($this->object->isError(401), 'Should BE an error'); $this->assertTrue($this->object->isError(500), 'Should BE an error'); }