From 0a54c021b9fdc191f32032a14529010526192c88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Mon, 29 Nov 2021 11:51:19 +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 --- src/ClientAbstracts.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ClientAbstracts.php b/src/ClientAbstracts.php index e4d6f6f..8740d77 100644 --- a/src/ClientAbstracts.php +++ b/src/ClientAbstracts.php @@ -9,7 +9,6 @@ use Http\Message\Stream; use JetBrains\PhpStorm\Pure; use Kiri\Context; use Kiri\Core\Help; -use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; use Swoole\Coroutine\System; @@ -48,7 +47,6 @@ abstract class ClientAbstracts implements IClient private int $port = 80; - private array $_responseHeader = []; @@ -84,12 +82,22 @@ abstract class ClientAbstracts implements IClient /** * @return array */ - public function getResponseHeader(): array + public function getResponseHeaders(): array { return $this->_responseHeader; } + /** + * @param string $key + * @return string|int|null + */ + public function getResponseHeader(string $key): null|string|int + { + return $this->_responseHeader[$key] ?? null; + } + + /** * @param array $responseHeader */