This commit is contained in:
2021-05-06 10:49:25 +08:00
parent e9efc14df5
commit bc1c72e4f6
4 changed files with 12 additions and 10 deletions
+5 -3
View File
@@ -4,7 +4,8 @@
namespace HttpServer\Client;
use Exception;
use JetBrains\PhpStorm\Pure;
use Snowflake\Abstracts\Component;
use Snowflake\Snowflake;
use Swoole\Coroutine;
@@ -22,16 +23,17 @@ class HttpClient extends Component
*/
public static function NewRequest(): IClient
{
return Coroutine::getCid() > 0 ? Client::NewRequest() : Curl::NewRequest();
return Coroutine::getCid() > -1 ? Client::NewRequest() : Curl::NewRequest();
}
/**
* @return Http2
* @throws Exception
*/
public static function http2(): Http2
{
return Snowflake::app()->http2;
return Snowflake::app()->get('http2');
}
}