[icinga-checkins] icinga.org: icingaweb2/master: JsonResponse: Set content type at initialization and not at sendHeaders

git at icinga.org git at icinga.org
Tue Oct 18 11:10:45 CEST 2016


Module: icingaweb2
Branch: master
Commit: 703561f8749acc064ffdbf5c90b599790e5efef6
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=703561f8749acc064ffdbf5c90b599790e5efef6

Author: Noah Hilverling <noah.hilverling at netways.de>
Date:   Mon Oct 17 16:33:51 2016 +0200

JsonResponse: Set content type at initialization and not at sendHeaders

refs #12161

---

 library/Icinga/Web/Response/JsonResponse.php |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/library/Icinga/Web/Response/JsonResponse.php b/library/Icinga/Web/Response/JsonResponse.php
index 2161414..47a2ccd 100644
--- a/library/Icinga/Web/Response/JsonResponse.php
+++ b/library/Icinga/Web/Response/JsonResponse.php
@@ -68,6 +68,13 @@ class JsonResponse extends Response
     protected $successData;
 
     /**
+     * Content type of this response
+     *
+     * @var string
+     */
+    protected $contentType = 'application/json';
+
+    /**
      * Get the JSON encoding options
      *
      * @return int
@@ -189,15 +196,6 @@ class JsonResponse extends Response
     /**
      * {@inheritdoc}
      */
-    public function sendHeaders()
-    {
-        $this->setContentType('application/json');
-        parent::sendHeaders();
-    }
-
-    /**
-     * {@inheritdoc}
-     */
     public function sendResponse()
     {
         Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->setNoRender(true);



More information about the icinga-checkins mailing list