Skip to content

Commit ca856bc

Browse files
committed
Merge pull request FriendsOfSymfony#107 from FriendsOfSymfony/use-jsonp-callback-validator
Use JsonCallbackValidator lib
2 parents 3973b22 + 95c30b8 commit ca856bc

File tree

4 files changed

+4
-146
lines changed

4 files changed

+4
-146
lines changed

Controller/Controller.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use FOS\JsRoutingBundle\Extractor\ExposedRoutesExtractorInterface;
1515
use FOS\JsRoutingBundle\Response\RoutesResponse;
1616
use FOS\JsRoutingBundle\Util\CacheControlConfig;
17-
use FOS\JsRoutingBundle\Validator\CallbackValidator;
1817
use Symfony\Component\Config\ConfigCache;
1918
use Symfony\Component\HttpFoundation\Request;
2019
use Symfony\Component\HttpFoundation\Response;
@@ -103,8 +102,8 @@ public function indexAction(Request $request, $_format)
103102
$content = file_get_contents((string) $cache);
104103

105104
if (null !== $callback = $request->query->get('callback')) {
106-
$validator = new CallbackValidator();
107-
if (!$validator->isValid($callback)) {
105+
$validator = new \JsonpCallbackValidator();
106+
if (!$validator->validate($callback)) {
108107
throw new HttpException(400, 'Invalid JSONP callback value');
109108
}
110109

Tests/Validator/CallbackValidatorTest.php

Lines changed: 0 additions & 60 deletions
This file was deleted.

Validator/CallbackValidator.php

Lines changed: 0 additions & 82 deletions
This file was deleted.

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"php": ">=5.3.2",
2121
"symfony/framework-bundle": "~2.0",
2222
"symfony/serializer": "~2.0",
23-
"symfony/console": "~2.0"
23+
"symfony/console": "~2.0",
24+
"willdurand/jsonp-callback-validator": "~1.0"
2425
},
2526
"autoload": {
2627
"psr-0": { "FOS\\JsRoutingBundle": "" }

0 commit comments

Comments
 (0)