We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 14a2a39 commit b12d8acCopy full SHA for b12d8ac
src/Plugin/RetryPlugin.php
@@ -4,6 +4,7 @@
4
5
use Http\Client\Common\Plugin;
6
use Http\Client\Exception;
7
+use Http\Client\Exception\HttpException;
8
use Http\Promise\Promise;
9
use Psr\Http\Message\RequestInterface;
10
use Psr\Http\Message\ResponseInterface;
@@ -56,7 +57,8 @@ public function __construct(array $config = [])
56
57
$resolver->setDefaults([
58
'retries' => 1,
59
'decider' => function (RequestInterface $request, Exception $e) {
- return true;
60
+ // do not retry client errors
61
+ return !($e instanceof HttpException && $e->getCode() < 500);
62
},
63
'delay' => __CLASS__.'::defaultDelay',
64
]);
0 commit comments