Request.php : Fix request merge method of data to query
This commit is contained in:
parent
d7b7c15f83
commit
bd64c79d5a
2 changed files with 17 additions and 1 deletions
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
### All notable changes to `CRM CLient V2` will be documented in this file.
|
||||
|
||||
Fixed : request merge method of data to query (Request.php)
|
||||
|
||||
# version 3.0.2
|
||||
- Regen documentation with php documentor
|
||||
|
||||
|
|
|
|||
|
|
@ -128,8 +128,22 @@ class Request
|
|||
{
|
||||
$this->request = function () {
|
||||
$uri = $this->uri;
|
||||
// * If query merge query and data, set data to empty.
|
||||
if ($this->method->equals(HttpMethods::get())) {
|
||||
$uri = sprintf("%s?%s", $uri, http_build_query($this->data));
|
||||
// * Merge query in url with Data
|
||||
$q = \parse_url($uri, \PHP_URL_QUERY) ?? '';
|
||||
$q = \strpos($q, '&') !== false ? explode('&', $q) : [];
|
||||
$query = [];
|
||||
foreach ($q as $qParam) {
|
||||
$qParam = explode('=', $qParam, 2);
|
||||
|
||||
$query[$qParam[0]] = $qParam[1];
|
||||
}
|
||||
// * Remove query part.
|
||||
$uri = strtok($uri, '?');
|
||||
// * Append build query
|
||||
$uri = sprintf("%s?%s", $uri, http_build_query(array_merge($query, $this->data)));
|
||||
|
||||
$this->data = [];
|
||||
}
|
||||
$request = new Psr7Request(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue