소스 검색

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