From a00ec4473cab6fc0f17675e091bf513b47a00b9c Mon Sep 17 00:00:00 2001 From: Timothy J Warren Date: Wed, 12 Apr 2017 12:52:49 -0400 Subject: [PATCH] Add method to add http2 server push headers --- src/View.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/View.php b/src/View.php index f8a4bbb..102b5ab 100644 --- a/src/View.php +++ b/src/View.php @@ -98,6 +98,19 @@ abstract class View return $this; } + /** + * Add an http2 server push header + * + * @param string $path - The host-relative path to the asset + * @param string $type - The type of asset + * @return ViewInterface + */ + public function addPushHeader(string $path, string $type): ViewInterface + { + $this->addHeader('Link', "<{$path}>; rel=preload; as={$type}"); + return $this; + } + /** * Set the output string *