add:新增忽略ssl方法

This commit is contained in:
JaguarJack 2020-10-14 20:07:36 +08:00
parent 9754a23360
commit 8991315888
2 changed files with 50 additions and 5 deletions

View File

@ -15,6 +15,7 @@ use think\Facade;
* @method static \catcher\library\client\Http put(string $url)
* @method static \catcher\library\client\Http delete(string $url)
* @method static \catcher\library\client\Http token(string $token)
* @method static \catcher\library\client\Http ignoreSsl()
* @method static \catcher\library\client\Http attach($name, $resource, $filename)
*
* @time 2020年05月22日

View File

@ -29,18 +29,39 @@ class Http
*/
protected $proxy = [];
/**
* body
*
* @var array
*/
protected $body = [];
/**
* header
*
* @var array
*/
protected $header = [];
/**
* form params
*
* @var array
*/
protected $formParams = [];
/**
* query set
*
* @var array
*/
protected $query = [];
/**
* json set
*
* @var array
*/
protected $json = [];
/**
@ -68,6 +89,14 @@ class Http
protected $token = '';
protected $multipart = [];
/**
* 忽略证书
*
* @var array
*/
protected $ignoreSsl = [];
/**
* 获取 Guzzle 客户端
*
@ -194,6 +223,20 @@ class Http
return $this;
}
/**
* 忽略 ssl 证书
*
* @return $this
*/
public function ignoreSsl()
{
$this->ignoreSsl = [
'verify' => false,
];
return $this;
}
/**
* 可选参数
*
@ -265,7 +308,8 @@ class Http
protected function merge()
{
return array_merge($this->header, $this->query, $this->timeout,
$this->options, $this->body, $this->auth, $this->multipart, $this->formParams
$this->options, $this->body, $this->auth, $this->multipart, $this->formParams,
$this->ignoreSsl
);
}