forked from GNUsocial/gnu-social
[CORE][Controller][TESTS] Fix issue that arrises in tests where the Accept header is not specified
This commit is contained in:
parent
d07cb79844
commit
e6d20bd30d
@ -100,8 +100,9 @@ class Controller extends AbstractController implements EventSubscriberInterface
|
|||||||
$template = $this->vars['_template'];
|
$template = $this->vars['_template'];
|
||||||
unset($this->vars['_template'], $this->vars['request']);
|
unset($this->vars['_template'], $this->vars['request']);
|
||||||
|
|
||||||
// Respond in the most preferred acceptable content type
|
// Respond in the the most preffered acceptable content type
|
||||||
$format = $request->getFormat($request->getAcceptableContentTypes()[0]);
|
$accept = $request->getAcceptableContentTypes() ?: ['text/html'];
|
||||||
|
$format = $request->getFormat($accept[0]);
|
||||||
switch ($format) {
|
switch ($format) {
|
||||||
case 'html':
|
case 'html':
|
||||||
$event->setResponse($this->render($template, $this->vars));
|
$event->setResponse($this->render($template, $this->vars));
|
||||||
|
Loading…
Reference in New Issue
Block a user