Exemple #1
0
 public function setUp()
 {
     $this->response = \Exedra\Runtime\Response::createEmptyResponse();
 }
Exemple #2
0
 /**
  * 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;
 }