Custom HTTP Status code not working in Sever

  apache, http-status-codes, laravel, laravel-7, php

I have changed the HTTP status code in my json response using Laravel. It’s working fine in localhost but the same code not working WHM server.

Laravel Version : 7
PHP Version : 7.4

My code

$encode = ['code' => 400,'message'  => 'Token is Invalid','data' => []];
return Response::make(json_encode($encode,JSON_PRETTY_PRINT|JSON_FORCE_OBJECT),401)->header('Content-Type',"application/json");

Local host Response

enter image description here

Server Response
enter image description here

Please anyone help to resolve this.

Thanks in advance..

Source: Laravel

Leave a Reply