diff --git a/HttpServer/Client/ClientAbstracts.php b/HttpServer/Client/ClientAbstracts.php index 4848550c..ecf97e80 100644 --- a/HttpServer/Client/ClientAbstracts.php +++ b/HttpServer/Client/ClientAbstracts.php @@ -7,6 +7,7 @@ namespace HttpServer\Client; use Closure; use Exception; +use JetBrains\PhpStorm\Pure; use Snowflake\Abstracts\Component; use Snowflake\Core\Help; use Snowflake\Core\Json; @@ -58,7 +59,7 @@ abstract class ClientAbstracts extends Component implements IClient /** * @return static */ - public static function NewRequest(): static + #[Pure] public static function NewRequest(): static { return new static(); } diff --git a/HttpServer/Client/Curl.php b/HttpServer/Client/Curl.php index a1cf7dfe..c4bdd5a1 100644 --- a/HttpServer/Client/Curl.php +++ b/HttpServer/Client/Curl.php @@ -50,14 +50,13 @@ class Curl extends ClientAbstracts if ($isHttps !== false) { $this->curlHandlerSslSet($resource); } - if (empty($params)) { + if (empty($params) && empty($this->getData())) { return $resource; } if ($method === self::GET && !empty($this->getData())) { curl_setopt($resource, CURLOPT_POSTFIELDS, $this->getData()); - } - if ($method === self::POST) { + } else if ($method === self::POST) { curl_setopt($resource, CURLOPT_POSTFIELDS, $this->mergeParams($params)); } if ($method === self::UPLOAD) {