diff --git a/src/Normalizer/JsonBlueprintDenormalizer.php b/src/Normalizer/JsonBlueprintDenormalizer.php index 1452e37e252eb098a6adfabafac42ee95745fb7a..422b9ecc96f806a2da9bdd86e7d54723af0d87f9 100644 --- a/src/Normalizer/JsonBlueprintDenormalizer.php +++ b/src/Normalizer/JsonBlueprintDenormalizer.php @@ -122,6 +122,15 @@ class JsonBlueprintDenormalizer implements DenormalizerInterface, SerializerAwar $raw_item['waitFor'] = !empty($raw_item['waitFor']) ? $raw_item['waitFor'] : ['']; $raw_item['_resolved'] = FALSE; + // Detect if there is an encoded token. If so, then decode the URI. + if ( + !empty($raw_item['uri']) && + strpos($raw_item['uri'], '%7B%7B') !== FALSE && + strpos($raw_item['uri'], '%7D%7D') !== FALSE + ) { + $raw_item['uri'] = urldecode($raw_item['uri']); + } + return $raw_item; } diff --git a/tests/src/Unit/Normalizer/JsonBlueprintDenormalizerTest.php b/tests/src/Unit/Normalizer/JsonBlueprintDenormalizerTest.php index f3d93d2712c985ae8522d33295092deb464c2599..572ee6a488a6343019ec545daf75913409dc34e2 100644 --- a/tests/src/Unit/Normalizer/JsonBlueprintDenormalizerTest.php +++ b/tests/src/Unit/Normalizer/JsonBlueprintDenormalizerTest.php @@ -59,7 +59,7 @@ class JsonBlueprintDenormalizerTest extends UnitTestCase { 'waitFor' => ['foo'], ]; $subrequests[] = [ - 'uri' => 'lorem', + 'uri' => 'lorem%3F%7B%7Bipsum%7D%7D', // lorem?{{ipsum}} 'action' => 'create', 'requestId' => 'oof', 'body' => '"bar"', @@ -70,7 +70,16 @@ class JsonBlueprintDenormalizerTest extends UnitTestCase { $tree->stack([new Subrequest(['waitFor' => [''], '_resolved' => FALSE, 'body' => 'bar'] + $subrequests[0])]); $tree->stack([ new Subrequest(['headers' => [], '_resolved' => FALSE, 'body' => []] + $subrequests[1]), - new Subrequest(['headers' => [], '_resolved' => FALSE, 'body' => 'bar'] + $subrequests[2]) + // Make sure the URL is decoded so we can perform apply regular + // expressions to it. + new Subrequest( + [ + 'headers' => [], + '_resolved' => FALSE, + 'body' => 'bar', + 'uri' => 'lorem?{{ipsum}}' + ] + $subrequests[2] + ) ]); $this->assertEquals($tree, $actual); }