|
5 | 5 | use Lkrms\Concern\HasBuilder; |
6 | 6 | use Lkrms\Concern\Immutable; |
7 | 7 | use Lkrms\Contract\Buildable; |
8 | | -use Lkrms\Contract\ICollection; |
9 | 8 | use Lkrms\Curler\Catalog\CurlerProperty; |
10 | 9 | use Lkrms\Curler\Contract\ICurlerPager; |
11 | 10 | use Lkrms\Curler\Exception\CurlerCurlErrorException; |
@@ -506,9 +505,7 @@ public function __construct( |
506 | 505 | $this->AlwaysPaginate = $alwaysPaginate; |
507 | 506 | $this->ObjectAsArray = $objectAsArray; |
508 | 507 |
|
509 | | - /** @var array<string,true> */ |
510 | | - $index = Arr::toIndex(Arr::lower(HttpHeaderGroup::SENSITIVE)); |
511 | | - $this->SensitiveHeaderIndex = $index; |
| 508 | + $this->SensitiveHeaderIndex = Arr::toIndex(Arr::lower(HttpHeaderGroup::SENSITIVE)); |
512 | 509 | } |
513 | 510 |
|
514 | 511 | /** |
@@ -601,6 +598,14 @@ public function with(string $property, $value) |
601 | 598 | return $this->withPropertyValue($property, $value); |
602 | 599 | } |
603 | 600 |
|
| 601 | + /** |
| 602 | + * Get request headers that are not considered sensitive |
| 603 | + */ |
| 604 | + public function getPublicHeaders(): HttpHeadersInterface |
| 605 | + { |
| 606 | + return $this->Headers->exceptIn($this->SensitiveHeaderIndex); |
| 607 | + } |
| 608 | + |
604 | 609 | /** |
605 | 610 | * @return $this |
606 | 611 | */ |
@@ -1058,10 +1063,7 @@ private function getCacheKey(): ?string |
1058 | 1063 |
|
1059 | 1064 | $key = $this->ResponseCacheKeyCallback |
1060 | 1065 | ? ($this->ResponseCacheKeyCallback)($this) |
1061 | | - : $this->Headers->filter( |
1062 | | - fn(string $key) => !($this->SensitiveHeaderIndex[$key] ?? false), |
1063 | | - ICollection::CALLBACK_USE_KEY |
1064 | | - )->getLines('%s:%s'); |
| 1066 | + : $this->getPublicHeaders()->getLines('%s:%s'); |
1065 | 1067 | if ($this->Method === HttpRequestMethod::POST) { |
1066 | 1068 | $key[] = $this->Body; |
1067 | 1069 | } |
|
0 commit comments