예제 #1
0
파일: HttpError.php 프로젝트: opis/http
 public function handle(Request $request, Response $response)
 {
     $response->headers($this->headers);
     $response->status($this->statusCode);
     $response->body($this->message);
     $response->send();
 }
예제 #2
0
파일: Resource.php 프로젝트: opis/http
 /**
  * Handle the response
  *
  * @param   \Opis\Http\Request  $request    Http request
  * @param   \Opis\Http\Response $response   Http response
  */
 public function handle(Request $request, Response $response)
 {
     $response->contentType(Mime::get($this->filePath));
     $file = $this->filePath;
     $response->body(function ($request, $response) use($file) {
         readfile($file);
     });
     $response->send();
 }
예제 #3
0
파일: File.php 프로젝트: opis/http
 /**
  * Handle the response
  *
  * @param   \Opis\Http\Request  $request    Http request
  * @param   \Opis\Http\Response $response   Http response
  */
 public function handle(Request $request, Response $response)
 {
     $opt = $this->options;
     $response->contentType($opt['contentType']);
     $response->header('content-disposition', vsprintf('%s; filename="%s"', array($opt['disposition'], $opt['fileName'])));
     $file = $this->filePath;
     $response->body(function ($request, $response) use($file) {
         readfile($file);
     });
     $response->send();
 }