->redirect impl.

This commit is contained in:
Greyscale 2020-11-18 09:08:06 +01:00
parent 85a4fd478f
commit e12ca4f023
No known key found for this signature in database
GPG key ID: C6178C19949CFFE3

View file

@ -65,6 +65,13 @@ abstract class AbstractController
return $response->withHeader('Content-type', 'application/json');
}
public function redirect(Response $response, string $url = "/", int $code = 302) : Response
{
$response = $response->withStatus($code);
return $response->withHeader("Location", $url);
}
public function jsonResponseException(\Exception $e, Request $request, Response $response): Response
{
return $this->jsonResponse(