コード例 #1
0
ファイル: ResponseTest.php プロジェクト: rosengate/exedra
 public function setUp()
 {
     $this->response = \Exedra\Runtime\Response::createEmptyResponse();
 }
コード例 #2
0
ファイル: Application.php プロジェクト: rosengate/exedra
 /**
  * Dispatch and return the response
  * Handle uncaught \Exedra\Exception\Exception
  * @param \Exedra\Http\ServerRequest|null $request
  * @return \Exedra\Runtime\Response
  */
 public function respond(\Exedra\Http\ServerRequest $request)
 {
     try {
         $response = $this->request($request)->finalize()->getResponse();
     } catch (\Exedra\Exception\Exception $e) {
         if ($failRoute = $this->failRoute) {
             $response = $this->execute($failRoute, array('exception' => $e), $request)->finalize()->getResponse();
             $this->setFailRoute(null);
         } else {
             $response = \Exedra\Runtime\Response::createEmptyResponse()->setStatus(404)->setBody($e->getMessage());
         }
     }
     return $response;
 }