From 4343fe351cbf8adfb4fb8ba43337dccf8e0b6384 Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Tue, 23 Dec 2014 09:22:15 -0500
Subject: [PATCH] Added ability to set JSON response status code.

---
 module/VuFind/src/VuFind/Controller/HierarchyController.php | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/module/VuFind/src/VuFind/Controller/HierarchyController.php b/module/VuFind/src/VuFind/Controller/HierarchyController.php
index 176eb17787d..41459221330 100644
--- a/module/VuFind/src/VuFind/Controller/HierarchyController.php
+++ b/module/VuFind/src/VuFind/Controller/HierarchyController.php
@@ -57,16 +57,18 @@ class HierarchyController extends AbstractBase
     /**
      * Output JSON
      *
-     * @param string $json A JSON string
+     * @param string $json   A JSON string
+     * @param int    $status Response status code
      *
      * @return \Zend\Http\Response
      */
-    protected function outputJSON($json)
+    protected function outputJSON($json, $status = 200)
     {
         $response = $this->getResponse();
         $headers = $response->getHeaders();
         $headers->addHeaderLine('Content-type', 'application/json');
         $response->setContent($json);
+        $response->setStatusCode($status);
         return $response;
     }
 
-- 
GitLab