Skip to content

Commit

Permalink
Merge pull request #469 from spencerrlongg/guzzle-stream-for-deprecation
Browse files Browse the repository at this point in the history
change stream_for() to Utils::streamFor() to retain Guzzle 7.2 compatibility
  • Loading branch information
yoshdog authored Jan 5, 2022
2 parents c4e499e + d615a47 commit 21ed028
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Zendesk/API/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\LazyOpenStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Utils;
use Psr\Http\Message\StreamInterface;
use Zendesk\API\Exceptions\ApiResponseException;
use Zendesk\API\Exceptions\AuthException;
Expand Down Expand Up @@ -66,7 +67,7 @@ public static function send(
$request = $request->withoutHeader('Content-Type');
$requestOptions['multipart'] = $options['multipart'];
} elseif (! empty($options['postFields'])) {
$request = $request->withBody(\GuzzleHttp\Psr7\stream_for(json_encode($options['postFields'])));
$request = $request->withBody(Utils::streamFor(json_encode($options['postFields'])));
} elseif (! empty($options['file'])) {
if ($options['file'] instanceof StreamInterface) {
$request = $request->withBody($options['file']);
Expand Down
3 changes: 2 additions & 1 deletion src/Zendesk/API/Utilities/OAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Utils;
use Zendesk\API\Exceptions\ApiResponseException;

class OAuth
Expand Down Expand Up @@ -38,7 +39,7 @@ public static function getAccessToken(Client $client, $subdomain, array $params,

try {
$request = new Request('POST', $authUrl, ['Content-Type' => 'application/json']);
$request = $request->withBody(\GuzzleHttp\Psr7\stream_for(json_encode($params)));
$request = $request->withBody(Utils::streamFor(json_encode($params)));
$response = $client->send($request);
} catch (RequestException $e) {
throw new ApiResponseException($e);
Expand Down

0 comments on commit 21ed028

Please sign in to comment.