Skip to content

Commit

Permalink
Always throw an error if the response code is not within the 200s
Browse files Browse the repository at this point in the history
  • Loading branch information
dritter committed Aug 15, 2022
1 parent d79334a commit f5c6b83
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/RemoteRequest/CurlRemoteGetRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static function ($curl, $header) use (&$headers) {
$curlErrno = curl_errno($curlHandle);
curl_close($curlHandle);

if ($body === false) {
if ($body === false || $status < 200 || $status >= 300) {
if (! $retriesLeft || in_array($curlErrno, self::RETRYABLE_ERROR_CODES, true) === false) {
if (! empty($status) && is_numeric($status)) {
throw FailedToGetFromRemoteUrl::withHttpStatus($url, (int) $status);
Expand Down

0 comments on commit f5c6b83

Please sign in to comment.