[php-symfony] Never return 406 when user accepts */*

When a query has header "Accept" set to "*/*" it means it accepts
everything. It is hence weird to return a 406.
This patch ensures it does not occur: when the query accepts everything
then we take any produced type.

This fixes #13334. This also partly makes the open PR #15560 obsolete
(or at least, it provides a workaround)
This commit is contained in:
Guillaume Turri 2025-05-09 21:02:30 +02:00
parent d6c4634269
commit f6e2173e0e
2 changed files with 8 additions and 0 deletions

View File

@ -204,6 +204,10 @@ class Controller extends AbstractController
return 'application/xml';
}
if (in_array('*/*', $accept)) {
return $produced[0];
}
// If we reach this point, we don't have a common ground between server and client
return null;
}

View File

@ -214,6 +214,10 @@ class Controller extends AbstractController
return 'application/xml';
}
if (in_array('*/*', $accept)) {
return $produced[0];
}
// If we reach this point, we don't have a common ground between server and client
return null;
}