Add method to add http2 server push headers
This commit is contained in:
parent
9105b40b5e
commit
a00ec4473c
13
src/View.php
13
src/View.php
@ -98,6 +98,19 @@ abstract class View
|
|||||||
return $this;
|
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
|
* Set the output string
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user