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