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

Commit

Permalink
mime lookup through hoa/Mime
Browse files Browse the repository at this point in the history
  • Loading branch information
Joan Fabrégat committed Mar 4, 2018
1 parent 953fe58 commit 1f22c3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codeinchq/lib-psr7responses",
"version": "1.1.6",
"version": "1.1.7",
"description": "A collection of PSR-7 responses",
"homepage": "https://github.com/codeinchq/lib-psr7responses",
"type": "library",
Expand All @@ -9,7 +9,8 @@
"php": ">=7.1",
"psr/http-message": "^1.0",
"guzzlehttp/psr7": "^1.4",
"codeinchq/lib-errordisplay": "^1.1"
"codeinchq/lib-errordisplay": "^1.1",
"hoa/mime": "3.17.01.10"
},
"require-dev": {
"phpunit/phpunit": "^7"
Expand All @@ -36,4 +37,4 @@
"*": "dist"
}
}
}
}
3 changes: 2 additions & 1 deletion src/FileResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
//
declare(strict_types = 1);
namespace CodeInc\Psr7Responses;
use Hoa\Mime\Mime;


/**
Expand Down Expand Up @@ -62,7 +63,7 @@ public function __construct(string $filePath, ?string $fileName = null, ?string

parent::__construct(
$f,
$mimeType ?? mime_content_type($filePath),
$mimeType ?? Mime::getMimeFromExtension($filePath),
filesize($filePath) ?: null,
$fileName ?? basename($filePath),
$asAttachment,
Expand Down

0 comments on commit 1f22c3f

Please sign in to comment.