From 6ee45251939c535c287224ba9813e7013501756d Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Fri, 29 Jul 2016 10:52:11 -0400 Subject: [PATCH] Fixed the cache plugin --- lib/Github/Client.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/Github/Client.php b/lib/Github/Client.php index 317b8a769e4..c11f7cd3b16 100644 --- a/lib/Github/Client.php +++ b/lib/Github/Client.php @@ -15,8 +15,10 @@ use Http\Client\HttpClient; use Http\Discovery\HttpClientDiscovery; use Http\Discovery\MessageFactoryDiscovery; +use Http\Discovery\StreamFactoryDiscovery; use Http\Discovery\UriFactoryDiscovery; use Http\Message\MessageFactory; +use Http\Message\SteamFactory; use Psr\Cache\CacheItemPoolInterface; /** @@ -110,6 +112,11 @@ class Client */ private $messageFactory; + /** + * @var StreamFactory + */ + private $streamFactory; + /** * @var Plugin[] */ @@ -141,6 +148,7 @@ public function __construct(HttpClient $httpClient = null) { $this->httpClient = $httpClient ?: HttpClientDiscovery::find(); $this->messageFactory = MessageFactoryDiscovery::find(); + $this->streamFactory = StreamFactoryDiscovery::find(); $this->responseHistory = new History(); $this->addPlugin(new GithubExceptionThrower()); @@ -382,7 +390,7 @@ public function addHeaders(array $headers) public function addCache(CacheItemPoolInterface $cachePool) { $this->removeCache(); - $this->addPlugin(new Plugin\CachePlugin($cachePool)); + $this->addPlugin(new Plugin\CachePlugin($cachePool, $this->streamFactory)); } /**