优化 http 客户端

This commit is contained in:
JaguarJack
2020-05-22 18:24:10 +08:00
parent 30e7829d21
commit 167ea743a0
2 changed files with 30 additions and 12 deletions

View File

@@ -34,6 +34,17 @@ class Response implements \ArrayAccess
return $this->response->getBody();
}
/**
* 响应内容
*
* @time 2020年05月22日
* @return false|string
*/
public function contents()
{
return $this->body()->getContents();
}
/**
*
* @time 2020年05月21日
@@ -41,7 +52,7 @@ class Response implements \ArrayAccess
*/
public function json():array
{
return \json_decode($this->response->getBody()->getContents(), true);
return \json_decode($this->contents(), true);
}
/**