I just can't understand, and don't know where else to look, as the response status code of the following code is always 200, even if I set it to 400 in the main Response class.
class Api_Controller extends Base_Controller
{
public function __construct()
{
parent::__construct();
//header("HTTP/1.0 404 Not Found"); ##> This works
//die();
$test = array('1' => '2');
die(Response::json($test, 400));
}
What am I missing? I'm not using any extended class, just the default...
Update
This is the output of the Response::json...
above: http://pastebin.com/RGcinSdg
As you can see, the output has the values that has been set... but still for some reason, returns 200
Update2
The output of var_dump(http_response_code());
is always 200
Update3 - Temporary fix
I have activated an extended version of Response::json
and add the following line to it
http_response_code($status);
But I would still much like to know why doesn't it does it, the way it should