From 3eade209dd9e3a807c16a7f42ac2ee24b11be2e6 Mon Sep 17 00:00:00 2001 From: Bas Kamer Date: Mon, 23 Oct 2017 17:22:37 +0200 Subject: [PATCH 1/2] return 'application/octet-stream' when type isn't known in map --- src/AssetService.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/AssetService.php b/src/AssetService.php index f467b06..b9c5c01 100644 --- a/src/AssetService.php +++ b/src/AssetService.php @@ -119,5 +119,7 @@ protected function getType($path) if (isset($this->types[$ext])) { return $this->types[$ext]; } + + return 'application/octet-stream'; } } From f0a5f98b8826b8affdc9efd070ef4e8fed810877 Mon Sep 17 00:00:00 2001 From: Bas Kamer Date: Mon, 23 Oct 2017 17:22:44 +0200 Subject: [PATCH 2/2] tests --- tests/src/AssetServiceTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/src/AssetServiceTest.php b/tests/src/AssetServiceTest.php index 51060dc..6c8b914 100644 --- a/tests/src/AssetServiceTest.php +++ b/tests/src/AssetServiceTest.php @@ -31,7 +31,7 @@ public function testGetAsset_noVendorPackage() { $asset = $this->service->getAsset('no-vendor', 'no-package', 'style.css'); $this->assertNull($asset->path); - $this->assertNull($asset->type); + $this->assertEquals('application/octet-stream', $asset->type); } public function testGetAsset_noType() @@ -41,6 +41,6 @@ public function testGetAsset_noType() $expect = $this->asset_dir . DIRECTORY_SEPARATOR . 'fake.txt'; $this->assertSame($expect, $asset->path); - $this->assertNull($asset->type); + $this->assertEquals('application/octet-stream', $asset->type); } }