Skip to content

Commit

Permalink
Guzzle related fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed May 23, 2023
1 parent 9dfa8be commit d42ff9d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
"require": {
"php": ">=5.6.0",
"cloudinary/transformation-builder-sdk": "^1",
"guzzlehttp/guzzle": "^6|^7",
"guzzlehttp/guzzle": "^6.5.8|^7.4.5",
"guzzlehttp/promises": "^1.5.3|^2.0",
"guzzlehttp/psr7": "^1.9.1|^2.5",
"teapot/status-code": "^1|^2",
"ext-json": "*",
"monolog/monolog": "^1|^2|^3",
Expand Down
6 changes: 3 additions & 3 deletions src/Api/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Cloudinary\Utils;
use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Promise;
use GuzzleHttp\Promise\Create;
use GuzzleHttp\Promise\PromiseInterface;
use GuzzleHttp\Psr7\LimitStream;
use InvalidArgumentException;
Expand Down Expand Up @@ -355,13 +355,13 @@ private function postLargeFileAsync($endPoint, $fileHandle, $parameters, $option
]
);

return Promise\rejection_for($e);
return Create::rejectionFor($e);
}

ArrayUtils::addNonEmptyFromOther($parameters, 'public_id', $uploadResult);
}

return Promise\promise_for($uploadResult);
return Create::promiseFor($uploadResult);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions src/Api/BaseApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Promise;
use GuzzleHttp\Promise\Create;
use GuzzleHttp\Promise\PromiseInterface;
use InvalidArgumentException;
use JsonSerializable;
Expand Down Expand Up @@ -330,7 +330,7 @@ function (ResponseInterface $response) {
['statusCode' => $response->getStatusCode()]
);
try {
return Promise\promise_for($this->handleApiResponse($response));
return Create::promiseFor($this->handleApiResponse($response));
} catch (Exception $e) {
$this->getLogger()->critical(
'Async request failed',
Expand All @@ -340,7 +340,7 @@ function (ResponseInterface $response) {
]
);

return Promise\rejection_for($e);
return Create::rejectionFor($e);
}
},
function (Exception $error) {
Expand All @@ -352,10 +352,10 @@ function (Exception $error) {
]
);
if ($error instanceof ClientException) {
return Promise\rejection_for($this->handleApiResponse($error->getResponse()));
return Create::rejectionFor($this->handleApiResponse($error->getResponse()));
}

return Promise\rejection_for($error);
return Create::rejectionFor($error);
}
);
}
Expand Down

0 comments on commit d42ff9d

Please sign in to comment.