Closed mgluesenkamp closed 3 years ago
I've now added the following in my fos_rest.yaml
:
fos_rest:
[...]
view:
view_response_listener: true
formats:
json: true
html: true
Now I get the following error:
[critical] Uncaught PHP Exception JMS\Serializer\Exception\UnsupportedFormatException: "The format "html" is not supported for serialization." at /var/www/symfony/vendor/jms/serializer/src/Serializer.php line 137
I’ve experimented a bit more and realized it was about the fallback to html
. I changed it to json
and now it works.
So, I closed the issue. Thanks anyways!
Hi,
I have the following error while executing unit tests in the test environment.
[error] Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException: "Format 'html' not supported, handler must be implemented" at /var/www/symfony/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php line 151
This is strange, because the route works in dev env without any problems. I've the same configuration for my environments (in
config/packages/fos_rest.yaml
):I have the same
.env
file for dev and test except the additional part for unit tests. Here it is:I can also post my
phpunit.xml.dist
, but it is not changed at all. The environment there is set to test. It would be nice if someone has an advice to solve my problem. Thanks!