Skip to content

Commit

Permalink
Merge pull request #107 from FriendsOfSymfony/use-jsonp-callback-vali…
Browse files Browse the repository at this point in the history
…dator

Use JsonCallbackValidator lib
  • Loading branch information
willdurand committed Oct 21, 2013
2 parents 3973b22 + 95c30b8 commit ca856bc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 146 deletions.
5 changes: 2 additions & 3 deletions Controller/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use FOS\JsRoutingBundle\Extractor\ExposedRoutesExtractorInterface;
use FOS\JsRoutingBundle\Response\RoutesResponse;
use FOS\JsRoutingBundle\Util\CacheControlConfig;
use FOS\JsRoutingBundle\Validator\CallbackValidator;
use Symfony\Component\Config\ConfigCache;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -103,8 +102,8 @@ public function indexAction(Request $request, $_format)
$content = file_get_contents((string) $cache);

if (null !== $callback = $request->query->get('callback')) {
$validator = new CallbackValidator();
if (!$validator->isValid($callback)) {
$validator = new \JsonpCallbackValidator();
if (!$validator->validate($callback)) {
throw new HttpException(400, 'Invalid JSONP callback value');
}

Expand Down
60 changes: 0 additions & 60 deletions Tests/Validator/CallbackValidatorTest.php

This file was deleted.

82 changes: 0 additions & 82 deletions Validator/CallbackValidator.php

This file was deleted.

3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"php": ">=5.3.2",
"symfony/framework-bundle": "~2.0",
"symfony/serializer": "~2.0",
"symfony/console": "~2.0"
"symfony/console": "~2.0",
"willdurand/jsonp-callback-validator": "~1.0"
},
"autoload": {
"psr-0": { "FOS\\JsRoutingBundle": "" }
Expand Down

0 comments on commit ca856bc

Please sign in to comment.