Skip to content

Commit

Permalink
Fix middleware "SetCacheHeaders" with download responses (#49138)
Browse files Browse the repository at this point in the history
  • Loading branch information
clementbirkle authored Nov 27, 2023
1 parent 38a996d commit 82fa4ac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Middleware/SetCacheHeaders.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\StreamedResponse;

class SetCacheHeaders
{
Expand Down Expand Up @@ -41,7 +42,7 @@ public function handle($request, Closure $next, $options = [])
{
$response = $next($request);

if (! $request->isMethodCacheable() || (! $response->getContent() && ! $response instanceof BinaryFileResponse)) {
if (! $request->isMethodCacheable() || (! $response->getContent() && ! $response instanceof BinaryFileResponse && ! $response instanceof StreamedResponse)) {
return $response;
}

Expand Down

0 comments on commit 82fa4ac

Please sign in to comment.