Ejemplo n.º 1
0
 public function handle(Request $request, Response $response)
 {
     $response->headers($this->headers);
     $response->status($this->statusCode);
     $response->body($this->message);
     $response->send();
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 3
0
Archivo: File.php Proyecto: 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();
 }