From f92cd857d3f261cce963aec36c7b3bb6cbe43667 Mon Sep 17 00:00:00 2001 From: lwj <465382251@qq.com> Date: Wed, 14 Dec 2022 10:27:35 +0800 Subject: [PATCH] Add get response headers --- src/Request.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Request.php b/src/Request.php index 7399215..1d1688c 100644 --- a/src/Request.php +++ b/src/Request.php @@ -38,6 +38,8 @@ class Request protected $version=''; + protected $response_headers=[]; + public function __construct(array $data) { $this->key=$data['key'] ?? ''; @@ -136,6 +138,9 @@ protected function send(){ die;*/ $response = $client->request($this->type, $url, $this->options); + $this->response_headers = $response->getHeaders(); + + return $response->getBody()->getContents(); } @@ -169,4 +174,11 @@ protected function exec(){ throw new Exception(json_encode($temp)); } } + + /** + * Get Response Headers + * */ + public function getResponseHeaders(){ + return $this->response_headers; + } }