Skip to content

Commit b279d33

Browse files
Slairmy丁少龙
andauthored
Fixed bug that the path with query params won't match route when using testing client. (#4338)
Co-authored-by: 丁少龙 <[email protected]>
1 parent 7d1b282 commit b279d33

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Client.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,14 @@ protected function init(string $method, string $path, array $options = []): Serv
199199
$headers = $options['headers'] ?? [];
200200
$multipart = $options['multipart'] ?? [];
201201

202+
$parsePath = parse_url($path);
203+
$path = $parsePath['path'];
204+
$uriPathQuery = $parsePath['query'] ?? [];
205+
if (! empty($uriPathQuery)) {
206+
parse_str($uriPathQuery, $pathQuery);
207+
$query = array_merge($pathQuery, $query);
208+
}
209+
202210
$data = $params;
203211

204212
// Initialize PSR-7 Request and Response objects.

src/Debug.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static function getRefCount($object): string
2121

2222
preg_match('/refcount\((\w+)\)/U', $data, $matched);
2323
$result = $matched[1];
24-
if(is_numeric($result)){
24+
if (is_numeric($result)) {
2525
return bcsub($result, '1');
2626
}
2727

0 commit comments

Comments
 (0)