Let's see what happens.
You call $this->redirect('/dados', 302);
, so let's look at it's source code:
public static function redirect($uri = '', $code = 302)
{
return HTTP::redirect($uri, $code);
}
Ok, we learnt $this->redirect('/dados')
would suffice, lets look at HTTP::redirect() next:
public static function redirect($uri = '', $code = 302)
{
$e = HTTP_Exception::factory($code);
if ( ! $e instanceof HTTP_Exception_Redirect)
throw new Kohana_Exception('Invalid redirect code \':code\'', array(
':code' => $code
));
throw $e->location($uri);
}
It will create an exception (HTTP_Exception_$code) and then throw it.
The exception should bubble up to Request_Client_Internal::execute_request() where the following catch block should handle it:
catch (HTTP_Exception $e)
{
// Get the response via the Exception
$response = $e->get_response();
}
But since you catch the exception it won't bubble up. This is one way to fix it.
try{
$this->redirect('/dados', 302);
} catch (HTTP_Exception_Redirect $e) {
throw $e;
} catch (Exception $e) {
$this->response->body(Json_View::factory(array("line ".$e->getLine()." of file ".$e->getFile().":".$e->getMessage()." - trace as string: ".$e->getTraceAsString())));
}