Skip to content

Commit ef715d9

Browse files
committed
Fix unpacking
1 parent 60a50f3 commit ef715d9

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/Http/Middleware/AddLinkHeaderForPreloadedAssets.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@ public function handle($request, $next)
1414
{
1515
return tap($next($request), function ($response) {
1616
if (count($assets = $this->manifest->assetsForPreloading()) > 0) {
17-
$response->header('Link', trim(implode(', ', array_filter([
18-
$response->headers->get('Link', null),
19-
...collect($assets)
20-
->map(fn ($attributes, $asset) => implode('; ', [
21-
"<$asset>",
22-
...collect(array_merge(['rel' => 'preload', 'as' => 'style'], $attributes))
23-
->map(fn ($value, $key) => "{$key}={$value}")
24-
->all(),
25-
]))
26-
->all(),
27-
]))));
17+
$response->header('Link', trim(implode(', ', array_filter(array_merge(
18+
[$response->headers->get('Link', null)],
19+
collect($assets)->map(fn ($attributes, $asset) => implode('; ', array_merge(
20+
["<$asset>"],
21+
collect(array_merge(['rel' => 'preload', 'as' => 'style'], $attributes))
22+
->map(fn ($value, $key) => "{$key}={$value}")
23+
->all(),
24+
)))->all(),
25+
)))));
2826
}
2927
});
3028
}

0 commit comments

Comments
 (0)