Merge pull request #1970 from jasonlfunk/master
Allow developers to set the Content-Disposition header in Response::download()
This commit is contained in:
@@ -202,9 +202,14 @@ class Response {
|
|||||||
// off to the HttpFoundation and let it create the header text.
|
// off to the HttpFoundation and let it create the header text.
|
||||||
$response = new static(File::get($path), 200, $headers);
|
$response = new static(File::get($path), 200, $headers);
|
||||||
|
|
||||||
|
// If the Content-Disposition header has already been set by the
|
||||||
|
// merge above, then do not override it with out generated one.
|
||||||
|
if (!isset($headers['Content-Disposition'])) {
|
||||||
$d = $response->disposition($name);
|
$d = $response->disposition($name);
|
||||||
|
$response = $response->header('Content-Disposition', $d);
|
||||||
|
}
|
||||||
|
|
||||||
return $response->header('Content-Disposition', $d);
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user