浏览代码

fix missing internal requests token

Olivier Massot 2 年之前
父节点
当前提交
547838e6e2
共有 1 个文件被更改,包括 8 次插入4 次删除
  1. 8 4
      src/Service/ApiLegacy/ApiLegacyRequestService.php

+ 8 - 4
src/Service/ApiLegacy/ApiLegacyRequestService.php

@@ -20,9 +20,10 @@ class ApiLegacyRequestService extends ApiRequestService
 {
     #[Pure]
     public function __construct(
-        HttpClientInterface $apiLegacyClient,
-        private Security $security,
-        private JWTTokenManagerInterface $jwtManager
+        HttpClientInterface                       $apiLegacyClient,
+        private readonly Security                 $security,
+        private readonly JWTTokenManagerInterface $jwtManager,
+        readonly private string                   $internalRequestsToken
     )
     {
         parent::__construct($apiLegacyClient);
@@ -33,7 +34,6 @@ class ApiLegacyRequestService extends ApiRequestService
      * @param string $url
      * @param array<mixed> $parameters
      * @param array<mixed> $options
-     * @noinspection PhpPossiblePolymorphicInvocationInspection
      */
     public function request(
         string $method,
@@ -74,6 +74,10 @@ class ApiLegacyRequestService extends ApiRequestService
         if ($jwt !== null) {
             $headers['authorization'] = 'BEARER ' . $jwt;
         }
+
+        // Add the internal requests token
+        $headers['internal-requests-token'] = $this->internalRequestsToken;
+
         $options['headers'] = array_merge($options['headers'] ?? [], $headers);
 
         return parent::request($method, $url, $parameters, $options);