config/packages/fos_rest.yaml
# Read the documentation: https://symfony.com/doc/master/bundles/FOSRestBundle/index.html
# fos_rest: ~
# param_fetcher_listener: true
# allowed_methods_listener: true
# routing_loader: true
# view:
# view_response_listener: true
# exception:
# codes:
# App\Exception\MyException: 403
# messages:
# App\Exception\MyException: Forbidden area.
# format_listener:
# rules:
# - { path: ^/api, prefer_extension: true, fallback_format: json, priorities: [ json, html ] }
fos_rest:
routing_loader:
include_format: false
exception:
enabled: true
# exception_controller: 'fos_rest.exception.twig_controller::showAction'
messages:
'Symfony\Component\HttpKernel\Exception\HttpException' : true
body_converter:
enabled: true
validate: true
validation_errors_argument: violations
view:
view_response_listener: true
format_listener:
rules:
- { path: '^/api', priorities: ['json'], fallback_format: 'json', prefer_extension: false }
- { path: '^/', priorities: ['text/html', '*/*'], fallback_format: html, prefer_extension: true }