From 69b763523c13500ee6854774d19806e2c6b078f9 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Wed, 5 Nov 2014 12:07:47 +0100 Subject: set the correct mime type for the firefox manifest --- controller/pagecontroller.php | 9 ++++++++- tests/unit/controller/PageControllerTest.php | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/controller/pagecontroller.php b/controller/pagecontroller.php index f55900a39..ac0384db2 100644 --- a/controller/pagecontroller.php +++ b/controller/pagecontroller.php @@ -14,6 +14,7 @@ namespace OCA\News\Controller; use \OCP\AppFramework\Http\TemplateResponse; +use \OCP\AppFramework\Http\JSONResponse; use \OCP\IRequest; use \OCP\IConfig; use \OCP\IL10N; @@ -129,7 +130,7 @@ class PageController extends Controller { $authors[] = $author['name']; } - return [ + $data = [ "name" => $config['name'], "type" => 'web', "default_locale" => $locale, @@ -142,6 +143,12 @@ class PageController extends Controller { "url" => $config['homepage'] ] ]; + + $response = new JSONResponse($data); + $response->addHeader('Content-Type', + 'application/x-web-app-manifest+json'); + + return $response; } } \ No newline at end of file diff --git a/tests/unit/controller/PageControllerTest.php b/tests/unit/controller/PageControllerTest.php index 48af6860f..0173c3075 100644 --- a/tests/unit/controller/PageControllerTest.php +++ b/tests/unit/controller/PageControllerTest.php @@ -156,7 +156,7 @@ class PageControllerTest extends \PHPUnit_Framework_TestCase { ->method('getLanguageCode') ->will($this->returnValue('de_DE')); - $result = $this->controller->manifest(); + $result = $this->controller->manifest()->getData(); $this->assertEquals($this->configData['name'], $result['name']); $this->assertEquals('web', $result['type']); $this->assertEquals( -- cgit v1.2.3