From f336dcc5824fa70ff80438f68e4cef7dad1bea5b Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Tue, 12 May 2015 10:44:32 +0200 Subject: [PATCH 1/2] added extension point in the BodyListener to customize if to decode or not --- EventListener/BodyListener.php | 37 +++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/EventListener/BodyListener.php b/EventListener/BodyListener.php index 96d547027..a7abfdab6 100644 --- a/EventListener/BodyListener.php +++ b/EventListener/BodyListener.php @@ -88,10 +88,9 @@ public function onKernelRequest(GetResponseEvent $event) $request = $event->getRequest(); $method = $request->getMethod(); $contentType = $request->headers->get('Content-Type'); - $isFormRequest = $this->isFormRequest($request); - $normalizeRequest = $this->normalizeForms && $isFormRequest; + $normalizeRequest = $this->normalizeForms && $this->isFormRequest($request); - if (!$isFormRequest && in_array($method, array('POST', 'PUT', 'PATCH', 'DELETE'))) { + if ($this->isDecodeable($request)) { $format = null === $contentType ? $request->getRequestFormat() : $request->getFormat($contentType); @@ -101,9 +100,8 @@ public function onKernelRequest(GetResponseEvent $event) $content = $request->getContent(); if (!$this->decoderProvider->supports($format)) { - if ( - $this->throwExceptionOnUnsupportedContentType && - $this->isNotAnEmptyDeleteRequestWithNoSetContentType($method, $content, $contentType) + if ($this->throwExceptionOnUnsupportedContentType + && $this->isNotAnEmptyDeleteRequestWithNoSetContentType($method, $content, $contentType) ) { throw new UnsupportedMediaTypeHttpException("Request body format '$format' not supported"); } @@ -136,17 +134,42 @@ public function onKernelRequest(GetResponseEvent $event) } } + /** + * Check if the Request is a not a DELETE with no content and no Content-Type + * + * @param $method + * @param $content + * @param $contentType + * @return bool + */ private function isNotAnEmptyDeleteRequestWithNoSetContentType($method, $content, $contentType) { return false === ('DELETE' === $method && empty($content) && null === $contentType); } - private function isFormRequest(Request $request) + /** + * Check if we should try to decode the body + * + * @param Request $request + * @return bool + */ + protected function isDecodeable(Request $request) { if (!in_array($request->getMethod(), array('POST', 'PUT', 'PATCH', 'DELETE'))) { return false; } + return !$this->isFormRequest($request); + } + + /** + * Check if the content type indicates a form submission + * + * @param Request $request + * @return bool + */ + protected function isFormRequest(Request $request) + { $contentTypeParts = explode(';', $request->headers->get('Content-Type')); if (isset($contentTypeParts[0])) { From a3ee6d7c4427d569d577e717ab8dccc1a857abbd Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Tue, 12 May 2015 15:06:59 +0200 Subject: [PATCH 2/2] make it possible to configure a service for all listeners --- DependencyInjection/Configuration.php | 76 ++++++++++--- DependencyInjection/FOSRestExtension.php | 132 +++++++++++++++------- Resources/doc/3-listener-support.rst | 22 ++++ Resources/doc/configuration-reference.rst | 39 +++++-- 4 files changed, 205 insertions(+), 64 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 69d19a2f0..9d71ee50b 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -26,7 +26,7 @@ */ class Configuration implements ConfigurationInterface { - private $forceOptionValues = array(false, true, 'force'); + public static $forceOptionValues = array(false, true, 'force'); /** * Generates the configuration tree. @@ -42,18 +42,37 @@ public function getConfigTreeBuilder() ->children() ->scalarNode('disable_csrf_role')->defaultNull()->end() ->arrayNode('access_denied_listener') - ->useAttributeAsKey('name') - ->prototype('boolean')->end() + ->canBeEnabled() + ->beforeNormalization() + ->ifArray()->then(function($v) { if (!empty($v) && empty($v['formats'])) { unset($v['enabled']); $v = array('enabled' => true, 'formats' => $v); } return $v; }) + ->end() + ->fixXmlConfig('format', 'formats') + ->children() + ->scalarNode('service')->defaultNull()->end() + ->arrayNode('formats') + ->useAttributeAsKey('name') + ->prototype('boolean')->end() + ->end() + ->end() ->end() ->scalarNode('unauthorized_challenge')->defaultNull()->end() - ->scalarNode('param_fetcher_listener')->defaultFalse() + ->arrayNode('param_fetcher_listener') ->validate() - ->ifNotInArray($this->forceOptionValues) - ->thenInvalid('The param_fetcher_listener option does not support %s. Please choose one of '.json_encode($this->forceOptionValues)) + ->ifNotInArray(Configuration::$forceOptionValues) + ->thenInvalid('The param_fetcher_listener option does not support %s. Please choose one of '.json_encode(Configuration::$forceOptionValues)) + ->end() + ->canBeEnabled() + ->children() + ->scalarNode('service')->defaultNull()->end() ->end() ->end() ->scalarNode('cache_dir')->cannotBeEmpty()->defaultValue('%kernel.cache_dir%/fos_rest')->end() - ->scalarNode('allowed_methods_listener')->defaultFalse()->end() + ->arrayNode('allowed_methods_listener') + ->canBeEnabled() + ->children() + ->scalarNode('service')->defaultNull()->end() + ->end() + ->end() ->arrayNode('routing_loader') ->addDefaultsIfNotSet() ->children() @@ -124,8 +143,18 @@ private function addViewSection(ArrayNodeDefinition $rootNode) ->prototype('boolean')->end() ->end() ->arrayNode('mime_types') - ->useAttributeAsKey('name') - ->prototype('variable')->end() + ->canBeEnabled() + ->beforeNormalization() + ->ifArray()->then(function($v) { if (!empty($v) && empty($v['formats'])) { unset($v['enabled']); $v = array('enabled' => true, 'formats' => $v); } return $v; }) + ->end() + ->fixXmlConfig('format', 'formats') + ->children() + ->scalarNode('service')->defaultNull()->end() + ->arrayNode('formats') + ->useAttributeAsKey('name') + ->prototype('variable')->end() + ->end() + ->end() ->end() ->arrayNode('formats') ->useAttributeAsKey('name') @@ -137,10 +166,18 @@ private function addViewSection(ArrayNodeDefinition $rootNode) ->defaultValue(array('html' => true)) ->prototype('boolean')->end() ->end() - ->scalarNode('view_response_listener')->defaultFalse() + ->arrayNode('view_response_listener') + ->beforeNormalization() + ->ifString()->then(function($v) { return array('enabled' => true, 'mode' => $v); }) + ->end() ->validate() - ->ifNotInArray($this->forceOptionValues) - ->thenInvalid('The view_response_listener option does not support %s. Please choose one of '.json_encode($this->forceOptionValues)) + ->ifTrue(function ($v) { return !in_array($v['mode'], Configuration::$forceOptionValues); }) + ->thenInvalid('The view_response_listener "mode" does not support %s. Please choose one of '.json_encode(Configuration::$forceOptionValues)) + ->end() + ->canBeEnabled() + ->children() + ->scalarNode('service')->defaultNull()->end() + ->scalarNode('mode')->defaultFalse()->end() ->end() ->end() ->scalarNode('failed_validation')->defaultValue(Codes::HTTP_BAD_REQUEST)->end() @@ -168,7 +205,9 @@ private function addBodyListenerSection(ArrayNodeDefinition $rootNode) ->fixXmlConfig('decoder', 'decoders') ->addDefaultsIfNotSet() ->canBeUnset() + ->canBeDisabled() ->children() + ->scalarNode('service')->defaultNull()->end() ->scalarNode('default_format')->defaultNull()->end() ->booleanNode('throw_exception_on_unsupported_content_type') ->defaultFalse() @@ -213,7 +252,9 @@ private function addFormatListenerSection(ArrayNodeDefinition $rootNode) return $v; }) ->end() + ->canBeEnabled() ->children() + ->scalarNode('service')->defaultNull()->end() ->arrayNode('rules') ->cannotBeOverwritten() ->prototype('array') @@ -235,8 +276,15 @@ private function addFormatListenerSection(ArrayNodeDefinition $rootNode) ->end() ->arrayNode('media_type') ->children() - ->scalarNode('version_regex') - ->defaultValue('/(v|version)=(?P[0-9\.]+)/') + ->arrayNode('version_regex') + ->canBeEnabled() + ->beforeNormalization() + ->ifString()->then(function($v) { return array('enabled' => true, 'regex' => $v); }) + ->end() + ->children() + ->scalarNode('service')->defaultNull()->end() + ->scalarNode('regex')->defaultValue('/(v|version)=(?P[0-9\.]+)/')->end() + ->end() ->end() ->end() ->end() diff --git a/DependencyInjection/FOSRestExtension.php b/DependencyInjection/FOSRestExtension.php index feaa23b2c..67d43819f 100644 --- a/DependencyInjection/FOSRestExtension.php +++ b/DependencyInjection/FOSRestExtension.php @@ -34,7 +34,7 @@ public function prepend(ContainerBuilder $container) $configs = $parameterBag->resolveValue($configs); $config = $this->processConfiguration(new Configuration(), $configs); - if (!empty($config['view']['view_response_listener'])) { + if ($config['view']['view_response_listener']['enabled']) { $container->prependExtensionConfig('sensio_framework_extra', array('view' => array('annotations' => false))); } } @@ -59,8 +59,8 @@ public function load(array $configs, ContainerBuilder $container) $loader->load('request.xml'); $container->setParameter('fos_rest.cache_dir', $config['cache_dir']); - $container->setParameter($this->getAlias().'.routing.loader.default_format', $config['routing_loader']['default_format']); - $container->setParameter($this->getAlias().'.routing.loader.include_format', $config['routing_loader']['include_format']); + $container->setParameter('fos_rest.routing.loader.default_format', $config['routing_loader']['default_format']); + $container->setParameter('fos_rest.routing.loader.include_format', $config['routing_loader']['include_format']); // The validator service alias is only set if validation is enabled for the request body converter $validator = $config['service']['validator']; @@ -68,7 +68,7 @@ public function load(array $configs, ContainerBuilder $container) foreach ($config['service'] as $key => $service) { if (null !== $service) { - $container->setAlias($this->getAlias().'.'.$key, $service); + $container->setAlias('fos_rest.'.$key, $service); } } @@ -81,7 +81,7 @@ public function load(array $configs, ContainerBuilder $container) $this->loadBodyListener($config, $loader, $container); $this->loadFormatListener($config, $loader, $container); $this->loadParamFetcherListener($config, $loader, $container); - $this->loadAllowedMethodsListener($config, $loader); + $this->loadAllowedMethodsListener($config, $loader, $container); $this->loadAccessDeniedListener($config, $loader, $container); } @@ -95,33 +95,50 @@ private function loadForm(array $config, XmlFileLoader $loader, ContainerBuilder private function loadAccessDeniedListener(array $config, XmlFileLoader $loader, ContainerBuilder $container) { - if (!empty($config['access_denied_listener'])) { + if ($config['access_denied_listener']['enabled'] && !empty($config['access_denied_listener']['formats'])) { $loader->load('access_denied_listener.xml'); - $container->setParameter($this->getAlias().'.access_denied_listener.formats', $config['access_denied_listener']); - $container->setParameter($this->getAlias().'.access_denied_listener.unauthorized_challenge', $config['unauthorized_challenge']); + + if (!empty($config['access_denied_listener']['service'])) { + $service = $container->getDefinition('fos_rest.allowed_methods_listener'); + $service->clearTag('kernel.event_listener'); + } + + $container->setParameter('fos_rest.access_denied_listener.formats', $config['access_denied_listener']['formats']); + $container->setParameter('fos_rest.access_denied_listener.unauthorized_challenge', $config['unauthorized_challenge']); } } - public function loadAllowedMethodsListener(array $config, XmlFileLoader $loader) + public function loadAllowedMethodsListener(array $config, XmlFileLoader $loader, ContainerBuilder $container) { - if (!empty($config['allowed_methods_listener'])) { + if ($config['allowed_methods_listener']['enabled']) { + + if (!empty($config['allowed_methods_listener']['service'])) { + $service = $container->getDefinition('fos_rest.allowed_methods_listener'); + $service->clearTag('kernel.event_listener'); + } + $loader->load('allowed_methods_listener.xml'); } } private function loadBodyListener(array $config, XmlFileLoader $loader, ContainerBuilder $container) { - if (!empty($config['body_listener'])) { + if ($config['body_listener']['enabled']) { $loader->load('body_listener.xml'); - $container->setParameter($this->getAlias().'.throw_exception_on_unsupported_content_type', $config['body_listener']['throw_exception_on_unsupported_content_type']); - $container->setParameter($this->getAlias().'.body_default_format', $config['body_listener']['default_format']); - $container->setParameter($this->getAlias().'.decoders', $config['body_listener']['decoders']); + if (!empty($config['body_listener']['service'])) { + $service = $container->getDefinition('fos_rest.body_listener'); + $service->clearTag('kernel.event_listener'); + } + + $container->setParameter('fos_rest.throw_exception_on_unsupported_content_type', $config['body_listener']['throw_exception_on_unsupported_content_type']); + $container->setParameter('fos_rest.body_default_format', $config['body_listener']['default_format']); + $container->setParameter('fos_rest.decoders', $config['body_listener']['decoders']); $arrayNormalizer = $config['body_listener']['array_normalizer']; if (null !== $arrayNormalizer['service']) { - $bodyListener = $container->getDefinition($this->getAlias().'.body_listener'); + $bodyListener = $container->getDefinition('fos_rest.body_listener'); $bodyListener->addArgument(new Reference($arrayNormalizer['service'])); $bodyListener->addArgument($arrayNormalizer['forms']); } @@ -130,9 +147,14 @@ private function loadBodyListener(array $config, XmlFileLoader $loader, Containe private function loadFormatListener(array $config, XmlFileLoader $loader, ContainerBuilder $container) { - if (!empty($config['format_listener']['rules'])) { + if ($config['format_listener']['enabled'] && !empty($config['format_listener']['rules'])) { $loader->load('format_listener.xml'); + if (!empty($config['format_listener']['service'])) { + $service = $container->getDefinition('fos_rest.format_listener'); + $service->clearTag('kernel.event_listener'); + } + foreach ($config['format_listener']['rules'] as $key => $rule) { if (!isset($rule['exception_fallback_format'])) { $config['format_listener']['rules'][$key]['exception_fallback_format'] = $rule['fallback_format']; @@ -140,15 +162,20 @@ private function loadFormatListener(array $config, XmlFileLoader $loader, Contai } $container->setParameter( - $this->getAlias().'.format_listener.rules', + 'fos_rest.format_listener.rules', $config['format_listener']['rules'] ); - if (!empty($config['format_listener']['media_type']['version_regex'])) { + if (!empty($config['format_listener']['media_type']['enabled']) && !empty($config['format_listener']['media_type']['version_regex'])) { $container->setParameter( - $this->getAlias().'.format_listener.media_type.version_regex', + 'fos_rest.format_listener.media_type.version_regex', $config['format_listener']['media_type']['version_regex'] ); + + if (!empty($config['format_listener']['media_type']['service'])) { + $service = $container->getDefinition('fos_rest.version_listener'); + $service->clearTag('kernel.event_listener'); + } } else { $container->removeDefinition('fos_rest.version_listener'); } @@ -157,11 +184,16 @@ private function loadFormatListener(array $config, XmlFileLoader $loader, Contai private function loadParamFetcherListener(array $config, XmlFileLoader $loader, ContainerBuilder $container) { - if (!empty($config['param_fetcher_listener'])) { + if ($config['param_fetcher_listener']['enabled']) { $loader->load('param_fetcher_listener.xml'); + if (!empty($config['param_fetcher_listener']['service'])) { + $service = $container->getDefinition('fos_rest.param_fetcher_listener'); + $service->clearTag('kernel.event_listener'); + } + if ('force' === $config['param_fetcher_listener']) { - $container->setParameter($this->getAlias().'.param_fetcher_listener.set_params_as_attributes', true); + $container->setParameter('fos_rest.param_fetcher_listener.set_params_as_attributes', true); } } } @@ -174,7 +206,7 @@ private function loadBodyConverter(array $config, $validator, XmlFileLoader $loa } if (!empty($config['body_converter']['validate'])) { - $container->setAlias($this->getAlias().'.validator', $validator); + $container->setAlias('fos_rest.validator', $validator); } if (!empty($config['body_converter']['validation_errors_argument'])) { @@ -189,18 +221,18 @@ private function loadBodyConverter(array $config, $validator, XmlFileLoader $loa private function loadView(array $config, XmlFileLoader $loader, ContainerBuilder $container) { if (!empty($config['view']['exception_wrapper_handler'])) { - $container->setParameter($this->getAlias().'.view.exception_wrapper_handler', $config['view']['exception_wrapper_handler']); + $container->setParameter('fos_rest.view.exception_wrapper_handler', $config['view']['exception_wrapper_handler']); } if (!empty($config['view']['jsonp_handler'])) { $handler = new DefinitionDecorator($config['service']['view_handler']); $handler->setPublic(true); - $jsonpHandler = new Reference($this->getAlias().'.view_handler.jsonp'); + $jsonpHandler = new Reference('fos_rest.view_handler.jsonp'); $handler->addMethodCall('registerHandler', array('jsonp', array($jsonpHandler, 'createResponse'))); - $container->setDefinition($this->getAlias().'.view_handler', $handler); + $container->setDefinition('fos_rest.view_handler', $handler); - $container->setParameter($this->getAlias().'.view_handler.jsonp.callback_param', $config['view']['jsonp_handler']['callback_param']); + $container->setParameter('fos_rest.view_handler.jsonp.callback_param', $config['view']['jsonp_handler']['callback_param']); if ('/(^[a-z0-9_]+$)|(^YUI\.Env\.JSONP\._[0-9]+$)/i' !== $config['view']['jsonp_handler']['callback_filter']) { throw new \LogicException('As of 1.2.0, the "callback_filter" parameter is deprecated, and is not used anymore. For more information, read: https://github.com/FriendsOfSymfony/FOSRestBundle/pull/642.'); @@ -211,17 +243,28 @@ private function loadView(array $config, XmlFileLoader $loader, ContainerBuilder } } - if (!empty($config['view']['mime_types'])) { + if ($config['view']['mime_types']['enabled']) { $loader->load('mime_type_listener.xml'); - $container->setParameter($this->getAlias().'.mime_types', $config['view']['mime_types']); + if (!empty($config['mime_type_listener']['service'])) { + $service = $container->getDefinition('fos_rest.mime_type_listener'); + $service->clearTag('kernel.event_listener'); + } + + $container->setParameter('fos_rest.mime_types', $config['view']['mime_types']); } else { - $container->setParameter($this->getAlias().'.mime_types', array()); + $container->setParameter('fos_rest.mime_types', array()); } - if (!empty($config['view']['view_response_listener'])) { + if ($config['view']['view_response_listener']['enabled']) { $loader->load('view_response_listener.xml'); - $container->setParameter($this->getAlias().'.view_response_listener.force_view', 'force' === $config['view']['view_response_listener']); + + if (!empty($config['view_response_listener']['service'])) { + $service = $container->getDefinition('fos_rest.view_response_listener'); + $service->clearTag('kernel.event_listener'); + } + + $container->setParameter('fos_rest.view_response_listener.force_view', 'force' === $config['view']['view_response_listener']['mode']); } $formats = array(); @@ -236,7 +279,7 @@ private function loadView(array $config, XmlFileLoader $loader, ContainerBuilder } } - $container->setParameter($this->getAlias().'.formats', $formats); + $container->setParameter('fos_rest.formats', $formats); foreach ($config['view']['force_redirects'] as $format => $code) { if (true === $code) { @@ -244,21 +287,21 @@ private function loadView(array $config, XmlFileLoader $loader, ContainerBuilder } } - $container->setParameter($this->getAlias().'.force_redirects', $config['view']['force_redirects']); + $container->setParameter('fos_rest.force_redirects', $config['view']['force_redirects']); if (!is_numeric($config['view']['failed_validation'])) { $config['view']['failed_validation'] = constant('\FOS\RestBundle\Util\Codes::'.$config['view']['failed_validation']); } - $container->setParameter($this->getAlias().'.failed_validation', $config['view']['failed_validation']); + $container->setParameter('fos_rest.failed_validation', $config['view']['failed_validation']); if (!is_numeric($config['view']['empty_content'])) { $config['view']['empty_content'] = constant('\FOS\RestBundle\Util\Codes::'.$config['view']['empty_content']); } - $container->setParameter($this->getAlias().'.empty_content', $config['view']['empty_content']); - $container->setParameter($this->getAlias().'.serialize_null', $config['view']['serialize_null']); - $container->setParameter($this->getAlias().'.default_engine', $config['view']['default_engine']); + $container->setParameter('fos_rest.empty_content', $config['view']['empty_content']); + $container->setParameter('fos_rest.serialize_null', $config['view']['serialize_null']); + $container->setParameter('fos_rest.default_engine', $config['view']['default_engine']); } private function loadException(array $config, XmlFileLoader $loader, ContainerBuilder $container) @@ -266,6 +309,11 @@ private function loadException(array $config, XmlFileLoader $loader, ContainerBu if ($config['exception']['enabled']) { $loader->load('exception_listener.xml'); + if (!empty($config['exception']['service'])) { + $service = $container->getDefinition('fos_rest.exception_listener'); + $service->clearTag('kernel.event_listener'); + } + if ($config['exception']['exception_controller']) { $container->setParameter('fos_rest.exception_listener.controller', $config['exception']['exception_controller']); } @@ -283,21 +331,21 @@ private function loadException(array $config, XmlFileLoader $loader, ContainerBu $this->testExceptionExists($exception); } - $container->setParameter($this->getAlias().'.exception.codes', $config['exception']['codes']); - $container->setParameter($this->getAlias().'.exception.messages', $config['exception']['messages']); + $container->setParameter('fos_rest.exception.codes', $config['exception']['codes']); + $container->setParameter('fos_rest.exception.messages', $config['exception']['messages']); } private function loadSerializer(array $config, ContainerBuilder $container) { if (!empty($config['serializer']['version'])) { - $container->setParameter($this->getAlias().'.serializer.exclusion_strategy.version', $config['serializer']['version']); + $container->setParameter('fos_rest.serializer.exclusion_strategy.version', $config['serializer']['version']); } if (!empty($config['serializer']['groups'])) { - $container->setParameter($this->getAlias().'.serializer.exclusion_strategy.groups', $config['serializer']['groups']); + $container->setParameter('fos_rest.serializer.exclusion_strategy.groups', $config['serializer']['groups']); } - $container->setParameter($this->getAlias().'.serializer.serialize_null', $config['serializer']['serialize_null']); + $container->setParameter('fos_rest.serializer.serialize_null', $config['serializer']['serialize_null']); } /** diff --git a/Resources/doc/3-listener-support.rst b/Resources/doc/3-listener-support.rst index 2aafea475..abd36b566 100644 --- a/Resources/doc/3-listener-support.rst +++ b/Resources/doc/3-listener-support.rst @@ -25,6 +25,28 @@ to enable a few additional listeners: view: view_response_listener: 'force' +It is possible to replace the service used for each of the listener if needed. +In this case, the Bundle listener will still be configured, however it will +not be registered in the kernel. The custom service listener will however not +be registered in the kernel, so it is up to the user to register it for the +appropriate event: + +.. code-block:: yaml + + # app/config/config.yml + fos_rest: + body_listener: + service: my_body_listener + + my.body_listener: + class: Acme\BodyListener + tags: + - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest, priority: 10 } + arguments: ['@fos_rest.decoder_provider', '%fos_rest.throw_exception_on_unsupported_content_type%'] + calls: + - [setDefaultFormat, ['%fos_rest.body_default_format%']] + + View Response Listener ---------------------- diff --git a/Resources/doc/configuration-reference.rst b/Resources/doc/configuration-reference.rst index ccafb7e48..16afa8570 100644 --- a/Resources/doc/configuration-reference.rst +++ b/Resources/doc/configuration-reference.rst @@ -3,16 +3,25 @@ Full default configuration .. code-block:: yaml +# Default configuration for extension with alias: "fos_rest" + fos_rest: disable_csrf_role: null access_denied_listener: + enabled: false + service: null + formats: - # Prototype - name: ~ + # Prototype + name: ~ unauthorized_challenge: null - param_fetcher_listener: false + param_fetcher_listener: + enabled: false + service: null cache_dir: '%kernel.cache_dir%/fos_rest' - allowed_methods_listener: false + allowed_methods_listener: + enabled: false + service: null routing_loader: default_format: null include_format: true @@ -39,9 +48,12 @@ Full default configuration # Prototype name: ~ mime_types: + enabled: false + service: null + formats: - # Prototype - name: ~ + # Prototype + name: ~ formats: # Prototype @@ -50,7 +62,10 @@ Full default configuration # Prototype name: ~ - view_response_listener: false + view_response_listener: + enabled: false + service: null + mode: false failed_validation: 400 empty_content: 204 exception_wrapper_handler: null @@ -71,6 +86,8 @@ Full default configuration # Prototype name: ~ body_listener: + enabled: true + service: null default_format: null throw_exception_on_unsupported_content_type: false decoders: @@ -81,6 +98,8 @@ Full default configuration service: null forms: false format_listener: + enabled: false + service: null rules: # URL path info @@ -97,5 +116,9 @@ Full default configuration exception_fallback_format: null priorities: [] media_type: - version_regex: '/(v|version)=(?P[0-9\.]+)/' + version_regex: + enabled: false + service: null + regex: '/(v|version)=(?P[0-9\.]+)/' +