From 474cd37f1b46e3ae4206420f9ce1b0bf2f928b58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Fabr=C3=A9gat?= Date: Mon, 8 Oct 2018 17:43:16 +0200 Subject: [PATCH 1/2] compatibility with codeinc/psr7-responses v2.1 --- src/Responses/AssetResponse.php | 13 +++++++------ src/Responses/MinifiedAssetResponse.php | 3 ++- src/Responses/NotModifiedAssetResponse.php | 6 +++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Responses/AssetResponse.php b/src/Responses/AssetResponse.php index 6f1a248..981c501 100644 --- a/src/Responses/AssetResponse.php +++ b/src/Responses/AssetResponse.php @@ -21,7 +21,7 @@ // declare(strict_types=1); namespace CodeInc\AssetsMiddleware\Responses; -use CodeInc\Psr7Responses\FileResponse; +use CodeInc\Psr7Responses\LocalFileResponse; /** @@ -30,7 +30,7 @@ * @package CodeInc\AssetsMiddleware\Responses * @author Joan Fabrégat */ -class AssetResponse extends FileResponse implements AssetResponseInterface +class AssetResponse extends LocalFileResponse implements AssetResponseInterface { /** * @var string @@ -41,18 +41,19 @@ class AssetResponse extends FileResponse implements AssetResponseInterface * AssetResponse constructor. * * @param string $assetPath - * @param string $mediaType + * @param string $contentType * @throws \CodeInc\MediaTypes\Exceptions\MediaTypesException */ - public function __construct(string $assetPath, string $mediaType) + public function __construct(string $assetPath, string $contentType) { $this->assetPath = $assetPath; parent::__construct( $assetPath, - basename($assetPath), 200, '', - $mediaType, + null, + $contentType, + null, false ); } diff --git a/src/Responses/MinifiedAssetResponse.php b/src/Responses/MinifiedAssetResponse.php index 47db066..6835514 100644 --- a/src/Responses/MinifiedAssetResponse.php +++ b/src/Responses/MinifiedAssetResponse.php @@ -59,11 +59,12 @@ public function __construct(string $assetPath, string $mediaType) $this->assetPath = $assetPath; $this->mediaType = $mediaType; parent::__construct( - $this->buildStream($assetPath), basename($assetPath), + $this->buildStream($assetPath), 200, '', $mediaType, + null, false ); } diff --git a/src/Responses/NotModifiedAssetResponse.php b/src/Responses/NotModifiedAssetResponse.php index 232a7c6..127d9d9 100644 --- a/src/Responses/NotModifiedAssetResponse.php +++ b/src/Responses/NotModifiedAssetResponse.php @@ -21,7 +21,7 @@ // declare(strict_types=1); namespace CodeInc\AssetsMiddleware\Responses; -use CodeInc\Psr7Responses\EmptyResponse; +use CodeInc\Psr7Responses\NotModifiedResponse; /** @@ -30,7 +30,7 @@ * @package CodeInc\AssetsMiddleware\Responses * @author Joan Fabrégat */ -class NotModifiedAssetResponse extends EmptyResponse implements AssetResponseInterface +class NotModifiedAssetResponse extends NotModifiedResponse implements AssetResponseInterface { /** * @var string @@ -45,7 +45,7 @@ class NotModifiedAssetResponse extends EmptyResponse implements AssetResponseInt public function __construct(string $assetPath) { $this->assetPath = $assetPath; - parent::__construct(304); + parent::__construct(); } /** From 12e492244caf7a39d00055ca9fbc6ac3884cdd07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Fabr=C3=A9gat?= Date: Mon, 8 Oct 2018 17:43:19 +0200 Subject: [PATCH 2/2] v2.0.2 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index c89161a..287bee0 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "codeinc/assets-middleware", - "version": "2.0.1", + "version": "2.0.2", "description": "A PSR-15 middleware to server static assets (CSS, JS, images, etc.)", "homepage": "https://github.com/CodeIncHQ/AssetsMiddleware", "type": "library",