Skip to content

Commit 6fe750e

Browse files
committed
Changes according to feedback
1 parent 6fa639d commit 6fe750e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/CachePlugin.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Http\Client\Plugin;
44

5+
use Http\Client\Utils\Promise\FulfilledPromise;
56
use Psr\Cache\CacheItemPoolInterface;
67
use Psr\Http\Message\RequestInterface;
78
use Psr\Http\Message\ResponseInterface;
@@ -62,7 +63,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
6263

6364
if ($cacheItem->isHit()) {
6465
// return cached response
65-
return $cacheItem->get();
66+
return new FulfilledPromise($cacheItem->get());
6667
}
6768

6869
return $next($request)->then(function (ResponseInterface $response) use ($cacheItem) {
@@ -83,7 +84,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
8384
*
8485
* @return bool
8586
*/
86-
private function isCacheable(ResponseInterface $response)
87+
protected function isCacheable(ResponseInterface $response)
8788
{
8889
if (!in_array($response->getStatusCode(), array(200, 203, 300, 301, 302, 404, 410))) {
8990
return false;

0 commit comments

Comments
 (0)