Skip to content

Commit a96054b

Browse files
authored
Merge pull request #408 from GrahamCampbell/patch-2
Fixed the cache plugin
2 parents b77da21 + 6ee4525 commit a96054b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/Github/Client.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
use Http\Client\HttpClient;
1616
use Http\Discovery\HttpClientDiscovery;
1717
use Http\Discovery\MessageFactoryDiscovery;
18+
use Http\Discovery\StreamFactoryDiscovery;
1819
use Http\Discovery\UriFactoryDiscovery;
1920
use Http\Message\MessageFactory;
21+
use Http\Message\SteamFactory;
2022
use Psr\Cache\CacheItemPoolInterface;
2123

2224
/**
@@ -110,6 +112,11 @@ class Client
110112
*/
111113
private $messageFactory;
112114

115+
/**
116+
* @var StreamFactory
117+
*/
118+
private $streamFactory;
119+
113120
/**
114121
* @var Plugin[]
115122
*/
@@ -141,6 +148,7 @@ public function __construct(HttpClient $httpClient = null)
141148
{
142149
$this->httpClient = $httpClient ?: HttpClientDiscovery::find();
143150
$this->messageFactory = MessageFactoryDiscovery::find();
151+
$this->streamFactory = StreamFactoryDiscovery::find();
144152

145153
$this->responseHistory = new History();
146154
$this->addPlugin(new GithubExceptionThrower());
@@ -382,7 +390,7 @@ public function addHeaders(array $headers)
382390
public function addCache(CacheItemPoolInterface $cachePool)
383391
{
384392
$this->removeCache();
385-
$this->addPlugin(new Plugin\CachePlugin($cachePool));
393+
$this->addPlugin(new Plugin\CachePlugin($cachePool, $this->streamFactory));
386394
}
387395

388396
/**

0 commit comments

Comments
 (0)