Changing guzzle adapter options
还没有人认领这个 Issue。
评估
调研方向
定位 API 客户端的构造函数以及 issue 中所示的 Guzzle 客户端创建代码。检查其 base URI 和 headers 当前的配置方式,然后确定哪种提议的选项形式适合现有的公共 API。完成标准是调用方可以配置 CA 文件或其他 Guzzle 选项,而无需编辑 php.ini 或环境设置。
由索引模型根据 Issue 内容生成。
描述
I've come across this issue while testing your api. Guzzle throws an exception complaining there's no ca file on a windows box. For those OS' without a default known ca file, see guzzle verify, it is not possible to set a default ca-file without altering the php.ini or PATH environment. To solve this issue,
Either
//to set options to the guzzle client
public getClient() { return $this->client; }
Or
public function __construct(Auth $auth, string $baseURI = null, $guzzleConfig = [])
{
if ($baseURI === null) {
$baseURI = 'https://api.cloudflare.com/client/v4/';
}
$headers = $auth->getHeaders();
$config = [
'base_uri' => $baseURI,
'headers' => $headers,
'Accept' => 'application/json'
] + $guzzleConfig;
$this->client = new Client($config);
}
Or
public function __construct(Auth $auth, string $baseURI = null, $caFile = false)
{
if ($baseURI === null) {
$baseURI = 'https://api.cloudflare.com/client/v4/';
}
$headers = $auth->getHeaders();
$config = [
'base_uri' => $baseURI,
'headers' => $headers,
'Accept' => 'application/json'
];
if ($caFile !== false) $config['verify'] = $caFile;
$this->client = new Client($config);
}
can be done.
- 主要语言
- PHP
- 星标
- 674
- 派生
- 268
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cloudflare/cloudflare-php 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 68/100
cloudflare/cloudflare-php#202 · 1 个 reaction ·
-
setEmailObfuscation have wrong configuration id.可能已有人在做 @emersonreisdev 于 2031 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 65/100
cloudflare/cloudflare-php#156 ·
-
难度 5/5 一周以上 新手友好度 25/100
cloudflare/cloudflare-php#278 · 5 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 35/100
cloudflare/cloudflare-php#272 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 20/100
cloudflare/cloudflare-php#264 ·
查看 cloudflare/cloudflare-php 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 83/100
nunomaduro/collision#375 ·
-
enhancement good first issue hacktoberfest help wanted
难度 2/5 1-3 小时 新手友好度 68/100
thetheago/laravel-seeder-versioning#19 ·
维护者通常 1 天内回复
-
HTTP::setGetVar() duplicates the base path for root-relative URLs when the site runs in a subfolder未关闭
难度 2/5 1-3 小时 新手友好度 74/100
silverstripe/silverstripe-framework#12034 ·
-
needs triage
难度 2/5 1-3 小时 新手友好度 72/100
-
loginWithCustomTokenExchange() fails when an organization is configured可能已有人在做 @awss1i 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 2 天内回复