Last active
September 15, 2021 15:43
-
-
Save jgauthi/2c9feddf607addb1a7db7afe31ea39f9 to your computer and use it in GitHub Desktop.
[Symfony] Example configuration bundle: Fos Rest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/packages/fos_rest.yaml | |
# Documentation: https://symfony.com/doc/master/bundles/FOSRestBundle/ | |
fos_rest: | |
routing_loader: false | |
view: | |
view_response_listener: 'force' | |
formats: | |
json: true | |
xml: true | |
zone: | |
- { path: '^/api' } | |
format_listener: | |
rules: | |
- { path: '^/api/', priorities: ['json'], fallback_format: 'json', prefer_extension: false } | |
body_listener: | |
enabled: true | |
param_fetcher_listener: | |
enabled: true | |
serializer: | |
serialize_null: true | |
exception: | |
enabled: true | |
map_exception_codes: true | |
messages: | |
'Symfony\Component\HttpKernel\Exception\HttpException': true | |
'Symfony\Component\Security\Core\Exception\BadCredentialsException': true | |
codes: | |
'Symfony\Component\HttpKernel\Exception\NotFoundHttpException': 404 | |
'Symfony\Component\Security\Core\Exception\BadCredentialsException': 401 | |
'Symfony\Component\Security\Core\Exception\AccessDeniedException': 403 | |
'LogicException': 500 | |
'InvalidArgumentException': 400 | |
'Exception': 400 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment