From 0773e21034c5bde0edda9b9d731f1aacb8632d1d Mon Sep 17 00:00:00 2001 From: "J. King" Date: Thu, 27 Jul 2017 09:21:00 -0400 Subject: [PATCH] Finish good-enough REST output; fixes #48 Tests can come later --- lib/REST/Response.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/REST/Response.php b/lib/REST/Response.php index ecd4c6e9..688c567d 100644 --- a/lib/REST/Response.php +++ b/lib/REST/Response.php @@ -23,13 +23,18 @@ class Response { function output() { if(!headers_sent()) { - header("Status: ".$this->code." ".Arsse::$lang->msg("HTTP.Status.".$this->code)); + try { + $statusText = Arsse::$lang->msg("HTTP.Status.".$this->code); + } catch(\JKingWeb\Arsse\Lang\Exception $e) { + $statusText = ""; + } + header("Status: ".$this->code." ".$statusText); $body = ""; if(!is_null($this->payload)) { header("Content-Type: ".$this->type); switch($this->type) { case self::T_JSON: - $body = json_encode($this->payload,\JSON_PRETTY_PRINT); + $body = (string) json_encode($this->payload,\JSON_PRETTY_PRINT); break; default: $body = (string) $this->payload;