From ecc023910644f373b36fb01f732859f1ec88fe5b Mon Sep 17 00:00:00 2001 From: Dominique FOURNIER Date: Wed, 19 May 2021 15:47:25 +0200 Subject: [PATCH] Outputrest : manage the http_response_code() if set --- src/Outputrest.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Outputrest.php b/src/Outputrest.php index 6f7d473..a88d764 100644 --- a/src/Outputrest.php +++ b/src/Outputrest.php @@ -32,9 +32,10 @@ class Outputrest extends Output $layout = FALSE, $replacement = array(), $variable = array (), $module = "") { - if (! isset ($variable["exceptionCode"])) - $variable["exceptionCode"] = 200; + $code = http_response_code(); + if (isset ($variable["exceptionCode"])) + $code = $variable["exceptionCode"]; $rest = new Rest (); - $rest->display ($data, $variable["exceptionCode"]); + $rest->display ($data, $code); } }