This commit is contained in:
2021-09-29 16:04:00 +08:00
parent 170cd1455f
commit 3f03bb0e8b
2 changed files with 12 additions and 10 deletions
+7 -7
View File
@@ -98,16 +98,16 @@ class Client extends ClientAbstracts
*/
private function setParams(SwowClient $client, $path, $data): string
{
$content = $this->getData()->getContents();
if (!empty($content)) {
$client->setData($content);
}
if ($this->isGet()) {
if (!empty($data)) $path .= '?' . $data;
if (!empty($this->getData())) {
$client->setData($this->getData());
}
} else {
if (!empty($this->getData())) {
$client->setData($this->getData());
} else {
$client->setData($this->mergeParams($data));
$data = $this->mergeParams($data);
if (!empty($data)) {
$client->setData($data);
}
}
return $path;
+5 -3
View File
@@ -55,12 +55,14 @@ class Curl extends ClientAbstracts
if ($isHttps !== false) {
$this->curlHandlerSslSet($resource);
}
if (empty($params) && empty($this->getData())) {
$contents = $this->getData()->getContents();
if (empty($params) && empty($contents)) {
return $resource;
}
if (!empty($this->getData())) {
curl_setopt($resource, CURLOPT_POSTFIELDS, $this->getData());
if (!empty($contents)) {
curl_setopt($resource, CURLOPT_POSTFIELDS, $contents);
} else if ($method === self::POST) {
curl_setopt($resource, CURLOPT_POSTFIELDS, $this->mergeParams($params));
} else if ($method === self::UPLOAD) {