I'm trying out slim responses object and redirect feature, i have routes and controllers like this :
routes :
$app->get('/', 'index:index')->setName('index');
in my controller i have this line :
return $response->withRedirect($this->router->pathFor('index'));
index function in index class :
public function index($request, $response)
{
return $this->view->render($response, 'index.html', $this->data);
}
its working, but it gives a HTML document response instead of redirecting me, is this correct behaviour ? if so, how do i redirect to that route ?