Skip to content

Commit

Permalink
change: http 配置项由 httpFactory 修改为 http (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
yansongda authored Apr 28, 2024
1 parent 1fbf987 commit 9e852f5
Show file tree
Hide file tree
Showing 5 changed files with 871 additions and 717 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v1.1.0

### changed

- change: http 配置项由 `httpFactory` 修改为 `http`(#17)

## v1.0.9

### fixed
Expand Down
8 changes: 4 additions & 4 deletions src/Artful.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Artful
/**
* @throws ContainerException
*/
private function __construct(array $config, Closure|ContainerInterface $container = null)
private function __construct(array $config, null|Closure|ContainerInterface $container = null)
{
$this->registerServices($config, $container);

Expand All @@ -78,7 +78,7 @@ public static function __callStatic(string $service, array $config)
/**
* @throws ContainerException
*/
public static function config(array $config = [], Closure|ContainerInterface $container = null): bool
public static function config(array $config = [], null|Closure|ContainerInterface $container = null): bool
{
if (self::hasContainer() && !($config['_force'] ?? false)) {
return false;
Expand Down Expand Up @@ -288,7 +288,7 @@ public static function ignite(Rocket $rocket): Rocket

Logger::info('[Artful] 准备请求第三方 API', $rocket->toArray());

$http = $httpFactory->create(array_merge($config->get('httpFactory', []), $rocket->getPayload()?->get('_http') ?? []));
$http = $httpFactory->create(array_merge($config->get('http', []), $rocket->getPayload()?->get('_http') ?? []));

Event::dispatch(new Event\HttpStart($rocket));

Expand Down Expand Up @@ -333,7 +333,7 @@ protected static function verifyPlugin(array $plugins): void
/**
* @throws ContainerException
*/
private function registerServices(array $config, Closure|ContainerInterface $container = null): void
private function registerServices(array $config, null|Closure|ContainerInterface $container = null): void
{
foreach ($this->coreService as $service) {
self::registerService($service, ContainerServiceProvider::class == $service ? $container : $config);
Expand Down
4 changes: 4 additions & 0 deletions web/docs/v1/appendix/special-params.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@
指定请求体。

将在组装 `Radar` 请求时使用,具体可参考:`\Yansongda\Artful\Plugin\AddRadarPlugin`

## `_http`

http 客户端的配置文件,将在 httpFactory 创建 http 客户端时使用
8 changes: 4 additions & 4 deletions web/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"type": "module",
"devDependencies": {
"@types/node": "^20.11.5",
"sass": "^1.70.0",
"vite": "^5.0.12",
"@types/node": "^20.12.7",
"sass": "^1.75.0",
"vite": "^5.2.10",
"vitepress": "1.0.0-rc.39",
"vue": "^3.4.15"
"vue": "^3.4.25"
},
"scripts": {
"web:dev": "vitepress dev",
Expand Down
Loading

0 comments on commit 9e852f5

Please sign in to comment.