function redirect(string $routeName, array $data = [], array $queryParams = []): Response
{
$response = new Response();
$response->withHeader('Location', urlFor($routeName, $data, $queryParams));
$response->getBody()->write("Hello");
return $response;
}
Added for test and it works
$response->getBody()->write("Hello");
but $response->withHeader is not.