[CORE][Controller] Fix bug where a JSON request could not recieve a redirect response
This commit is contained in:
parent
94449c9153
commit
7a8d67f1e2
|
@ -81,7 +81,6 @@ abstract class Controller extends AbstractController implements EventSubscriberI
|
|||
*/
|
||||
public function __invoke(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
$class = static::class;
|
||||
$method = 'on' . ucfirst(mb_strtolower($request->getMethod()));
|
||||
$attributes = array_diff_key($request->attributes->get('_route_params'), array_flip(['_format', '_fragment', '_locale', 'template', 'accept', 'is_system_path']));
|
||||
|
@ -156,10 +155,10 @@ abstract class Controller extends AbstractController implements EventSubscriberI
|
|||
'vars' => $this->vars,
|
||||
'response' => &$potential_response,
|
||||
]) !== Event::stop) {
|
||||
if ($format === 'json') {
|
||||
$event->setResponse(new JsonResponse($response));
|
||||
} elseif ($redirect !== false) {
|
||||
if ($redirect !== false) {
|
||||
$event->setResponse(new RedirectResponse($redirect));
|
||||
} elseif ($format === 'json') {
|
||||
$event->setResponse(new JsonResponse($response));
|
||||
} elseif (!\is_null($template)) {
|
||||
$event->setResponse($this->render($template, $this->vars));
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue
Block a user