diff --git a/lib/public/appframework/controller.php b/lib/public/appframework/controller.php
index 398304e6febdbb4db805ad4f423463fd01b72191..00981df05baef9dab0d8f1a4b05f303bef4689ec 100644
--- a/lib/public/appframework/controller.php
+++ b/lib/public/appframework/controller.php
@@ -70,7 +70,7 @@ abstract class Controller {
 						$data->getData(),
 						$data->getStatus()
 					);
-					$response->setHeaders($data->getHeaders());
+					$response->setHeaders(array_merge($data->getHeaders(), $response->getHeaders()));
 					return $response;
 				} else {
 					return new JSONResponse($data);
diff --git a/tests/lib/appframework/controller/ControllerTest.php b/tests/lib/appframework/controller/ControllerTest.php
index d186651dc2301bcac914fb951f117fca1aa52a19..18d47d00f6b5877321d21d000ed692a71519f2a7 100644
--- a/tests/lib/appframework/controller/ControllerTest.php
+++ b/tests/lib/appframework/controller/ControllerTest.php
@@ -173,7 +173,8 @@ class ControllerTest extends \Test\TestCase {
 	public function testFormatDataResponseJSON() {
 		$expectedHeaders = array(
 			'test' => 'something',
-			'Cache-Control' => 'no-cache, must-revalidate'
+			'Cache-Control' => 'no-cache, must-revalidate',
+			'Content-Type' => 'application/json; charset=utf-8'
 		);
 
 		$response = $this->controller->customDataResponse(array('hi'));