File tree Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -33,21 +33,14 @@ public function __construct(array $queryParams)
33
33
*/
34
34
public function handleRequest (RequestInterface $ request , callable $ next , callable $ first )
35
35
{
36
- foreach ($ this ->queryParams as $ name => $ value ) {
37
- $ uri = $ request ->getUri ();
38
- $ array = [];
39
- parse_str ($ uri ->getQuery (), $ array );
40
-
41
- // If query value is not found
42
- if (!isset ($ array [$ name ])) {
43
- $ array [$ name ] = $ value ;
44
-
45
- // Create a new request with the new URI with the added query param
46
- $ request = $ request ->withUri (
47
- $ uri ->withQuery (http_build_query ($ array ))
48
- );
49
- }
50
- }
36
+ $ uri = $ request ->getUri ();
37
+
38
+ parse_str ($ uri ->getQuery (), $ query );
39
+ $ query += $ this ->queryParams ;
40
+
41
+ $ request = $ request ->withUri (
42
+ $ uri ->withQuery (http_build_query ($ query ))
43
+ );
51
44
52
45
return $ next ($ request );
53
46
}
You can’t perform that action at this time.
0 commit comments