From 8edfdfc8bd712d6ffd7e2ac08fdab802766bc10b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 31 Mar 2021 11:03:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HttpServer/Client/Http2.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/HttpServer/Client/Http2.php b/HttpServer/Client/Http2.php index a6d976cd..89aa1f8b 100644 --- a/HttpServer/Client/Http2.php +++ b/HttpServer/Client/Http2.php @@ -15,6 +15,7 @@ use Snowflake\Exception\NotFindClassException; use Snowflake\Snowflake; use Swoole\Http2\Request; use Swoole\Coroutine\Http2\Client as H2Client; +use Swoole\Http2\Response; /** @@ -130,7 +131,13 @@ class Http2 extends Component $pool->push($request, 'request.' . $method . $path); $pool->push($client, 'http2.' . $domain); }); - return Help::toArray($client->recv()); + + /** @var Response $response */ + $response = $client->recv(); + if ($response->statusCode > 200) { + throw new Exception($client->errMsg, $response->statusCode); + } + return Help::toArray($response->data); }