mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-11-14 03:42:41 +09:00
Update composer dependencies
This commit is contained in:
@@ -10,7 +10,6 @@ use Http\Client\HttpClient;
|
||||
use Http\Discovery\HttpClientDiscovery;
|
||||
use Http\Discovery\MessageFactoryDiscovery;
|
||||
use Http\Discovery\StreamFactoryDiscovery;
|
||||
use Http\Message\MessageFactory;
|
||||
use Http\Message\RequestFactory;
|
||||
use Http\Message\StreamFactory;
|
||||
use Psr\Cache\CacheItemPoolInterface;
|
||||
@@ -38,7 +37,7 @@ class Builder
|
||||
private $pluginClient;
|
||||
|
||||
/**
|
||||
* @var MessageFactory
|
||||
* @var RequestFactory
|
||||
*/
|
||||
private $requestFactory;
|
||||
|
||||
@@ -62,7 +61,7 @@ class Builder
|
||||
/**
|
||||
* This plugin is special treated because it has to be the very last plugin.
|
||||
*
|
||||
* @var Plugin\CachePlugin
|
||||
* @var Plugin\CachePlugin|null
|
||||
*/
|
||||
private $cachePlugin;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class ResponseMediator
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
*
|
||||
* @return array|null
|
||||
* @return array|void
|
||||
*/
|
||||
public static function getPagination(ResponseInterface $response)
|
||||
{
|
||||
|
||||
@@ -30,26 +30,26 @@ class GithubExceptionThrower implements Plugin
|
||||
|
||||
// If error:
|
||||
$remaining = ResponseMediator::getHeader($response, 'X-RateLimit-Remaining');
|
||||
if (null != $remaining && 1 > $remaining && 'rate_limit' !== substr($request->getRequestTarget(), 1, 10)) {
|
||||
if (null !== $remaining && 1 > $remaining && 'rate_limit' !== substr($request->getRequestTarget(), 1, 10)) {
|
||||
$limit = ResponseMediator::getHeader($response, 'X-RateLimit-Limit');
|
||||
$reset = ResponseMediator::getHeader($response, 'X-RateLimit-Reset');
|
||||
|
||||
throw new ApiLimitExceedException($limit, $reset);
|
||||
}
|
||||
|
||||
if (401 === $response->getStatusCode()) {
|
||||
if ($response->hasHeader('X-GitHub-OTP') && 0 === strpos((string) ResponseMediator::getHeader($response, 'X-GitHub-OTP'), 'required;')) {
|
||||
$type = substr((string) ResponseMediator::getHeader($response, 'X-GitHub-OTP'), 9);
|
||||
if ((401 === $response->getStatusCode()) && $response->hasHeader('X-GitHub-OTP') && 0 === strpos((string) ResponseMediator::getHeader($response, 'X-GitHub-OTP'), 'required;')) {
|
||||
$type = substr((string) ResponseMediator::getHeader($response, 'X-GitHub-OTP'), 9);
|
||||
|
||||
throw new TwoFactorAuthenticationRequiredException($type);
|
||||
}
|
||||
throw new TwoFactorAuthenticationRequiredException($type);
|
||||
}
|
||||
|
||||
$content = ResponseMediator::getContent($response);
|
||||
if (is_array($content) && isset($content['message'])) {
|
||||
if (400 == $response->getStatusCode()) {
|
||||
if (400 === $response->getStatusCode()) {
|
||||
throw new ErrorException($content['message'], 400);
|
||||
} elseif (422 == $response->getStatusCode() && isset($content['errors'])) {
|
||||
}
|
||||
|
||||
if (422 === $response->getStatusCode() && isset($content['errors'])) {
|
||||
$errors = [];
|
||||
foreach ($content['errors'] as $error) {
|
||||
switch ($error['code']) {
|
||||
@@ -84,6 +84,17 @@ class GithubExceptionThrower implements Plugin
|
||||
}
|
||||
}
|
||||
|
||||
if (502 == $response->getStatusCode() && isset($content['errors']) && is_array($content['errors'])) {
|
||||
$errors = [];
|
||||
foreach ($content['errors'] as $error) {
|
||||
if (isset($error['message'])) {
|
||||
$errors[] = $error['message'];
|
||||
}
|
||||
}
|
||||
|
||||
throw new RuntimeException(implode(', ', $errors), 502);
|
||||
}
|
||||
|
||||
throw new RuntimeException(isset($content['message']) ? $content['message'] : $content, $response->getStatusCode());
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user