Skip to content

Commit b768574

Browse files
refactor(guzzle): upgrade to version 7.5
1 parent 592fb81 commit b768574

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
}
1515
],
1616
"require": {
17-
"guzzlehttp/guzzle": "~5.2",
18-
"guzzlehttp/cache-subscriber": "0.1.*@dev",
19-
"php": ">=5.3.3"
17+
"guzzlehttp/guzzle": "^7.5",
18+
"php": "^7.2.5 || ^8.0"
2019
},
2120
"autoload": {
2221
"psr-0": {"Foxy\\FoxyClient": "src/"}

src/Foxy/FoxyClient/FoxyClient.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,6 @@ public function get($uri = "", $post = null)
190190
return $this->go('GET', $uri, $post);
191191
}
192192

193-
public function put($uri, $post = null)
194-
{
195-
return $this->go('PUT', $uri, $post);
196-
}
197-
198193
public function post($uri, $post = null)
199194
{
200195
return $this->go('POST', $uri, $post);
@@ -241,7 +236,7 @@ private function go($method, $uri, $post, $is_retry = false)
241236
if ($method === "GET" && $post !== null) {
242237
$guzzle_args['query'] = $post;
243238
} elseif ($post !== null) {
244-
$guzzle_args['body'] = $post;
239+
$guzzle_args['form_params'] = $post;
245240
}
246241

247242
if (!$this->handle_exceptions) {
@@ -262,14 +257,13 @@ private function go($method, $uri, $post, $is_retry = false)
262257
private function processRequest($method, $uri, $post, $guzzle_args, $is_retry = false)
263258
{
264259
// special case for PATCHing a Downloadable File
265-
if ($post !== null && is_array($post) && array_key_exists('file', $post) && $method == 'PATCH') {
260+
if ($post !== null && array_key_exists('file', $post) && $method == 'PATCH') {
266261
$method = 'POST';
267262
$guzzle_args['headers']['X-HTTP-Method-Override'] = 'PATCH';
268263
}
269264

270-
$api_request = $this->guzzle->createRequest($method, $uri, $guzzle_args);
271-
$this->last_response = $this->guzzle->send($api_request);
272-
$data = $this->last_response->json();
265+
$this->last_response = $this->guzzle->request($method, $uri, $guzzle_args);
266+
$data = json_decode($this->last_response->getBody()->getContents(),true);
273267
$this->saveLinks($data);
274268
if ($this->hasExpiredAccessTokenError($data) && !$this->shouldRefreshToken()) {
275269
if (!$is_retry) {

0 commit comments

Comments
 (0)