Welcome Guest, Not a member yet? Register   Sign In
set exception 400 to 404
#1

I have error BadRequest with code 400
how to handle it to force show as 404?

can you help?

CodeIgniter\HTTP\Exceptions\BadRequestException
Reply
#2

(05-21-2024, 06:54 PM)mylastof Wrote: I have error BadRequest with code 400
how to handle it to force show as 404?

can you help?

CodeIgniter\HTTP\Exceptions\BadRequestException

If you are controlling the response yourself, e.g. in your controller, you can return specific HTTP response (below), however if a server is genuinely returning a 400 error I personally would not want to change this, instead take i'd try to take the appropriate action based on the server response.
PHP Code:
return $this->response->setStatusCode(404); 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB