How to execute a route directly?

I have the same need as here
I’m on slim 3 and I have controller/method mapped with a route.
Then when I try to do this:
/** @var \Slim\Route $ourRoute */
$ourRoute = $app->getContainer()->get(‘router’)->getNamedRoute(‘myroute’);
// Run query
$response = $ourRoute->run($app->getContainer()->get(‘request’), $app->getContainer()->get(‘response’));
Then the code inside my controller is directly executed and I get directly the output on my web browser.
What I want to do is to return the $response so I can manipulate it as I want.

Thanks for help.

You probably want __invoke instead of run.

I’ve already tested this method with outputBuffering = ‘append’ and this condition is true "if (!empty($output) && $response->getBody()->isWritable()) ", the variable $output is correctly what I need . But I get nothing on the body of the $response.