Hi,
I'm trying to do the same thing with filters as suggested by Dave Friend, but even my initial experiments (to prove that the response can be messed with) of simply trying to override the return status code in an after filter isn't working.
Code:
class ExceptionFilter implements FilterInterface {
public function before(RequestInterface $request) {
// Do something here
}
//--------------------------------------------------------------------
public function after(RequestInterface $request, ResponseInterface $response) {
$status_code = $response->getStatusCode();
if ($status_code < 308) return $response;
$response->setStatusCode(200, 'OK'); // $statusCodes[200] = 'OK'
return $response;
I have the ENVIRONMENT=production for these tests (otherwise CI detailed exceptions get shown with a code trace).
Could someone please explain this to me?
Thanks.