Пример #1
0
 /**
  * Sends a HTTP response and logs the message that was sent.
  *
  * @param integer $status
  * @param string $message
  */
 public function send($status = 200, $message = '')
 {
     $statMessage = ResponseUtil::statusMessage($status);
     if (!isset($this->response->body)) {
         // Copy the headers into the response JSON for inferior HTTP client
         // libraries that don't know how to read response headers:
         $this->response['httpHeaders'] = $this->response->httpHeader;
         if (function_exists('getallheaders')) {
             $this->response['reqHeaders'] = getallheaders();
         }
     }
     $this->log("sent [{$status} {$statMessage}]" . (empty($message) ? '' : ": {$message}"));
     $this->response->sendHttp($status, $message);
 }