CodeIgniter Forums
CurlRequest ignore exception - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: CurlRequest ignore exception (/showthread.php?tid=88941)



CurlRequest ignore exception - ozornick - 12-05-2023

I would like to work with the statuses and the body of the JSON response. But the 400-500 status stops the request. Is it possible to implement this? 

For example, there is no post in the database, a PageNotFoundException + JSON is created in the body. In JS/PHPUnit, can I read the 404 status and decode the body with custom message?


RE: CurlRequest ignore exception - kenjis - 12-05-2023

See https://codeigniter4.github.io/CodeIgniter4/libraries/curlrequest.html#http-errors


RE: CurlRequest ignore exception - ozornick - 12-06-2023

Thanks, for some reason I missed it at the docs