Skip to content

Commit d53e0fa

Browse files
committed
add default request header by context
1 parent a35cec2 commit d53e0fa

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Libraries/Client.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
use GuzzleHttp\Psr7\Request;
2020
use Psr\Http\Message\ResponseInterface;
2121
use Spotlibs\PhpLib\Exceptions\StdException;
22+
use Spotlibs\PhpLib\Services\Context;
23+
use Spotlibs\PhpLib\Services\Metadata;
2224

2325
/**
2426
* ClientTimeoutUnit
@@ -67,6 +69,11 @@ class Client extends BaseClient
6769
*/
6870
public function __construct(array $config = [])
6971
{
72+
$context = app(Context::class);
73+
$metadata = $context->get(Metadata::class);
74+
foreach ((array) $metadata as $key => $value) {
75+
$this->requestHeaders[$key] = $value;
76+
}
7077
parent::__construct($config);
7178
}
7279

0 commit comments

Comments
 (0)