Skip to content

Commit

Permalink
Add get response headers
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed Dec 14, 2022
1 parent 73f7434 commit f92cd85
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class Request

protected $version='';

protected $response_headers=[];

public function __construct(array $data)
{
$this->key=$data['key'] ?? '';
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -169,4 +174,11 @@ protected function exec(){
throw new Exception(json_encode($temp));
}
}

/**
* Get Response Headers
* */
public function getResponseHeaders(){
return $this->response_headers;
}
}

0 comments on commit f92cd85

Please sign in to comment.