改名
This commit is contained in:
@@ -7,6 +7,7 @@ namespace HttpServer\Client;
|
|||||||
use Closure;
|
use Closure;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
use JetBrains\PhpStorm\Pure;
|
||||||
use Snowflake\Abstracts\Component;
|
use Snowflake\Abstracts\Component;
|
||||||
use Snowflake\Core\Help;
|
use Snowflake\Core\Help;
|
||||||
use Snowflake\Core\Json;
|
use Snowflake\Core\Json;
|
||||||
@@ -58,7 +59,7 @@ abstract class ClientAbstracts extends Component implements IClient
|
|||||||
/**
|
/**
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function NewRequest(): static
|
#[Pure] public static function NewRequest(): static
|
||||||
{
|
{
|
||||||
return new static();
|
return new static();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,14 +50,13 @@ class Curl extends ClientAbstracts
|
|||||||
if ($isHttps !== false) {
|
if ($isHttps !== false) {
|
||||||
$this->curlHandlerSslSet($resource);
|
$this->curlHandlerSslSet($resource);
|
||||||
}
|
}
|
||||||
if (empty($params)) {
|
if (empty($params) && empty($this->getData())) {
|
||||||
return $resource;
|
return $resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($method === self::GET && !empty($this->getData())) {
|
if ($method === self::GET && !empty($this->getData())) {
|
||||||
curl_setopt($resource, CURLOPT_POSTFIELDS, $this->getData());
|
curl_setopt($resource, CURLOPT_POSTFIELDS, $this->getData());
|
||||||
}
|
} else if ($method === self::POST) {
|
||||||
if ($method === self::POST) {
|
|
||||||
curl_setopt($resource, CURLOPT_POSTFIELDS, $this->mergeParams($params));
|
curl_setopt($resource, CURLOPT_POSTFIELDS, $this->mergeParams($params));
|
||||||
}
|
}
|
||||||
if ($method === self::UPLOAD) {
|
if ($method === self::UPLOAD) {
|
||||||
|
|||||||
Reference in New Issue
Block a user