Пример #1
0
 public function handle(Request $request, Response $response)
 {
     $response->headers($this->headers);
     $response->status($this->statusCode);
     $response->body($this->message);
     $response->send();
 }
Пример #2
0
 /**
  * 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();
 }