Skip to content

Commit

Permalink
fixed mime type listener
Browse files Browse the repository at this point in the history
  • Loading branch information
lsmith77 committed Oct 9, 2011
1 parent 5342324 commit e812b88
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private function addViewSection(ArrayNodeDefinition $rootNode)
->arrayNode('mime_types')
->useAttributeAsKey('name')
->defaultValue(array())
->prototype('scalar')->end()
->prototype('variable')->end()
->end()
->arrayNode('formats')
->useAttributeAsKey('name')
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/FOSRestExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function load(array $configs, ContainerBuilder $container)
}

if (!empty($config['view']['mime_types'])) {
$loader->load('mime_types_listener.xml');
$loader->load('mime_type_listener.xml');

$container->setParameter($this->getAlias().'.mime_types', $config['view']['mime_types']);
} else {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ http://symfony.com/doc/current/cookbook/request/mime_type.html
# app/config/config.yml
fos_rest:
view:
mime_types: ['jsonp': 'application/javascript']
mime_types: ['jsonp': ['application/javascript', 'application/javascript+jsonp']]
```
Expand Down
2 changes: 1 addition & 1 deletion Resources/config/mime_type_listener.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<services>

<service id="fos_rest.mime_type_listener" class="FOS\RestBundle\EventListener\MimeTypeListener">
<tag name="kernel.event_listener" event="kernel.request" method="onKernelRequest" priority="-200" />
<tag name="kernel.event_listener" event="kernel.request" method="onKernelRequest" priority="200" />
<argument>%fos_rest.mime_types%</argument>
</service>

Expand Down
2 changes: 1 addition & 1 deletion Tests/EventListener/MimeTypeListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MimeTypeListenerTest extends \PHPUnit_Framework_TestCase
{
public function testOnKernelRequest()
{
$listener = new MimeTypeListener(array('jsonp' => 'application/javascript'));
$listener = new MimeTypeListener(array('jsonp' => array('application/javascript')));

$request = new Request;
$event = $this->getMockBuilder('\Symfony\Component\HttpKernel\Event\GetResponseEvent')->disableOriginalConstructor()->getMock();
Expand Down

0 comments on commit e812b88

Please sign in to comment.