[icinga-checkins] icinga.org: icingaweb2/bugfix/icinga-web-2-doesn't-set-content-type-12161: Response: Set header Content-Type for every response by default

git at icinga.org git at icinga.org
Fri Oct 14 16:17:29 CEST 2016


Module: icingaweb2
Branch: bugfix/icinga-web-2-doesn't-set-content-type-12161
Commit: af5c578adfd1497a98e202ca24300d30ad4fe2ff
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=af5c578adfd1497a98e202ca24300d30ad4fe2ff

Author: Noah Hilverling <noah.hilverling at netways.de>
Date:   Fri Oct 14 16:16:13 2016 +0200

Response: Set header Content-Type for every response by default

refs #12161

---

 library/Icinga/Web/Response.php              |    2 ++
 library/Icinga/Web/Response/JsonResponse.php |    2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/library/Icinga/Web/Response.php b/library/Icinga/Web/Response.php
index 71536c2..11773a5 100644
--- a/library/Icinga/Web/Response.php
+++ b/library/Icinga/Web/Response.php
@@ -275,6 +275,8 @@ class Response extends Zend_Controller_Response_Http
                 $this->setRedirect($redirectUrl->getAbsoluteUrl());
             }
         }
+
+        $this->setHeader("Content-Type", $this->getContentType(), true);
     }
 
     /**
diff --git a/library/Icinga/Web/Response/JsonResponse.php b/library/Icinga/Web/Response/JsonResponse.php
index 8a9ba7d..2161414 100644
--- a/library/Icinga/Web/Response/JsonResponse.php
+++ b/library/Icinga/Web/Response/JsonResponse.php
@@ -191,7 +191,7 @@ class JsonResponse extends Response
      */
     public function sendHeaders()
     {
-        $this->setHeader('Content-Type', 'application/json', true);
+        $this->setContentType('application/json');
         parent::sendHeaders();
     }
 



More information about the icinga-checkins mailing list