Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
subrequests
Commits
77a90fc5
Unverified
Commit
77a90fc5
authored
Oct 19, 2017
by
Mateu Aguiló Bosch
Browse files
fix(JsonPathReplacer): Decode incoming URLs
parent
70ef7e44
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Normalizer/JsonBlueprintDenormalizer.php
View file @
77a90fc5
...
...
@@ -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
;
}
...
...
tests/src/Unit/Normalizer/JsonBlueprintDenormalizerTest.php
View file @
77a90fc5
...
...
@@ -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
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment