summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Normalizer/JsonBlueprintDenormalizer.php9
-rw-r--r--tests/src/Unit/Normalizer/JsonBlueprintDenormalizerTest.php13
2 files changed, 20 insertions, 2 deletions
diff --git a/src/Normalizer/JsonBlueprintDenormalizer.php b/src/Normalizer/JsonBlueprintDenormalizer.php
index 1452e37..422b9ec 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'] : ['<ROOT>'];
$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 f3d93d2..572ee6a 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' => ['<ROOT>'], '_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);
}