Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

Commit

Permalink
Merge pull request #13 from CodeIncHQ/2.x
Browse files Browse the repository at this point in the history
v2.0.2
  • Loading branch information
Joan Fabrégat authored Oct 8, 2018
2 parents da651fe + 12e4922 commit 2ca017d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
13 changes: 7 additions & 6 deletions src/Responses/AssetResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//
declare(strict_types=1);
namespace CodeInc\AssetsMiddleware\Responses;
use CodeInc\Psr7Responses\FileResponse;
use CodeInc\Psr7Responses\LocalFileResponse;


/**
Expand All @@ -30,7 +30,7 @@
* @package CodeInc\AssetsMiddleware\Responses
* @author Joan Fabrégat <[email protected]>
*/
class AssetResponse extends FileResponse implements AssetResponseInterface
class AssetResponse extends LocalFileResponse implements AssetResponseInterface
{
/**
* @var string
Expand All @@ -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
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Responses/MinifiedAssetResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Responses/NotModifiedAssetResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//
declare(strict_types=1);
namespace CodeInc\AssetsMiddleware\Responses;
use CodeInc\Psr7Responses\EmptyResponse;
use CodeInc\Psr7Responses\NotModifiedResponse;


/**
Expand All @@ -30,7 +30,7 @@
* @package CodeInc\AssetsMiddleware\Responses
* @author Joan Fabrégat <[email protected]>
*/
class NotModifiedAssetResponse extends EmptyResponse implements AssetResponseInterface
class NotModifiedAssetResponse extends NotModifiedResponse implements AssetResponseInterface
{
/**
* @var string
Expand All @@ -45,7 +45,7 @@ class NotModifiedAssetResponse extends EmptyResponse implements AssetResponseInt
public function __construct(string $assetPath)
{
$this->assetPath = $assetPath;
parent::__construct(304);
parent::__construct();
}

/**
Expand Down

0 comments on commit 2ca017d

Please sign in to comment.