public function handleException(Exception $e, Request $request, Response $response)
 {
     $response->clearHeaders();
     $hdr = "HTTP/1.1 {$e->getCode()} {$e->getHeaderMessage()}";
     $response->header($hdr);
     foreach ($e->getHeaders() as $hdr) {
         $response->header($hdr);
     }
     $response->setData($e->getMessage());
 }
 public function handleException(Exception $e, Request $request, Response $response)
 {
     $response->clearHeaders();
     $code = 500;
     $hdrMsg = RestException::$HEADER_MESSAGES[$code];
     $msg = RestException::$MESSAGES[$code];
     $hdr = "HTTP/1.1 {$code} {$hdrMsg}";
     $response->header($hdr);
     $response->setData($msg);
 }
示例#3
0
 public function encode(Response $response)
 {
     $response->header('Content-Type: text/plain');
     return (string) $response->getData();
 }
示例#4
0
 public function encode(Response $response)
 {
     return $response->getData();
 }