In Slim 3 I set the error code and the message, I’m migrated to version 4, and it seems that the withStatus method doesn’t give me the function to set the write
function discover(Request $request, Response $response, $args)
{
return $response->withStatus(403)->write('.....');
}