From 1a38be78951e7ff66e3d96f9c750817b0f8c3161 Mon Sep 17 00:00:00 2001 From: Dag Date: Sun, 15 May 2022 23:16:38 +0200 Subject: [PATCH] fix: caching http client was not using the provided config --- src/http/CachingHttpClient.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/http/CachingHttpClient.php b/src/http/CachingHttpClient.php index 15ea2ad..28b14ec 100755 --- a/src/http/CachingHttpClient.php +++ b/src/http/CachingHttpClient.php @@ -32,19 +32,17 @@ final class CachingHttpClient implements HttpClient return $cachedResponse->withHeader('thirdplace-cache', 'local hit'); } - $headers = []; - if ($cachedResponse) { if ($cachedResponse->header('last-modified')) { - $headers['if-modified-since'] = $cachedResponse->header('last-modified'); + $config['headers']['if-modified-since'] = $cachedResponse->header('last-modified'); } if ($cachedResponse->header('etag')) { - $headers['if-none-match'] = $cachedResponse->header('etag'); + $config['headers']['if-none-match'] = $cachedResponse->header('etag'); } } try { - $response = $this->client->request($method, $url, ['headers' => $headers]); + $response = $this->client->request($method, $url, $config); $this->cache->set($isCachedKey, true, $this->ttl); -- 2.45.2