public function handle(Request $request, Response $response) { $response->headers($this->headers); $response->status($this->statusCode); $response->body($this->message); $response->send(); }
/** * 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(); }
/** * 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(); }