Skip to content
This repository
Browse code

fixed mime type listener

  • Loading branch information...
commit e812b885bb621c86863612a662f7df5d48127f64 1 parent 5342324
Lukas Kahwe Smith authored October 09, 2011
2  DependencyInjection/Configuration.php
@@ -85,7 +85,7 @@ private function addViewSection(ArrayNodeDefinition $rootNode)
85 85
                         ->arrayNode('mime_types')
86 86
                             ->useAttributeAsKey('name')
87 87
                             ->defaultValue(array())
88  
-                            ->prototype('scalar')->end()
  88
+                            ->prototype('variable')->end()
89 89
                         ->end()
90 90
                         ->arrayNode('formats')
91 91
                             ->useAttributeAsKey('name')
2  DependencyInjection/FOSRestExtension.php
@@ -99,7 +99,7 @@ public function load(array $configs, ContainerBuilder $container)
99 99
         }
100 100
 
101 101
         if (!empty($config['view']['mime_types'])) {
102  
-            $loader->load('mime_types_listener.xml');
  102
+            $loader->load('mime_type_listener.xml');
103 103
 
104 104
             $container->setParameter($this->getAlias().'.mime_types', $config['view']['mime_types']);
105 105
         } else {
2  README.md
Source Rendered
@@ -417,7 +417,7 @@ http://symfony.com/doc/current/cookbook/request/mime_type.html
417 417
 # app/config/config.yml
418 418
 fos_rest:
419 419
     view:
420  
-        mime_types: ['jsonp': 'application/javascript']
  420
+        mime_types: ['jsonp': ['application/javascript', 'application/javascript+jsonp']]
421 421
 ```
422 422
 
423 423
 
2  Resources/config/mime_type_listener.xml
@@ -7,7 +7,7 @@
7 7
     <services>
8 8
 
9 9
         <service id="fos_rest.mime_type_listener" class="FOS\RestBundle\EventListener\MimeTypeListener">
10  
-            <tag name="kernel.event_listener" event="kernel.request" method="onKernelRequest" priority="-200" />
  10
+            <tag name="kernel.event_listener" event="kernel.request" method="onKernelRequest" priority="200" />
11 11
             <argument>%fos_rest.mime_types%</argument>
12 12
         </service>
13 13
 
2  Tests/EventListener/MimeTypeListenerTest.php
@@ -23,7 +23,7 @@ class MimeTypeListenerTest extends \PHPUnit_Framework_TestCase
23 23
 {
24 24
     public function testOnKernelRequest()
25 25
     {
26  
-        $listener = new MimeTypeListener(array('jsonp' => 'application/javascript'));
  26
+        $listener = new MimeTypeListener(array('jsonp' => array('application/javascript')));
27 27
 
28 28
         $request = new Request;
29 29
         $event = $this->getMockBuilder('\Symfony\Component\HttpKernel\Event\GetResponseEvent')->disableOriginalConstructor()->getMock();

0 notes on commit e812b88

Please sign in to comment.
Something went wrong with that request. Please try again.