更新 Speed/Convoy.php
This commit is contained in:
parent
0ca7c9edab
commit
bc5511fe52
@ -13,7 +13,7 @@ class Convoy extends Server
|
|||||||
{
|
{
|
||||||
public function request($url, $method = 'get', $data = []): array
|
public function request($url, $method = 'get', $data = []): array
|
||||||
{
|
{
|
||||||
// Trim any leading slashes from the base url and add the path URL to it
|
// Trim any leading slashes from the base url and add the path url to it
|
||||||
$req_url = rtrim($this->config('host'), '/') . '/api/application/' . $url;
|
$req_url = rtrim($this->config('host'), '/') . '/api/application/' . $url;
|
||||||
$response = Http::withHeaders([
|
$response = Http::withHeaders([
|
||||||
'Authorization' => 'Bearer ' . $this->config('api_key'),
|
'Authorization' => 'Bearer ' . $this->config('api_key'),
|
||||||
@ -22,11 +22,7 @@ class Convoy extends Server
|
|||||||
|
|
||||||
if (!$response->successful()) {
|
if (!$response->successful()) {
|
||||||
$json = $response->json();
|
$json = $response->json();
|
||||||
if (is_array($json)) {
|
$message = $json['message'] ?? $json['error'] ?? 'Server Error';
|
||||||
$message = $json['message'] ?? $json['error'] ?? $json['errors'][0]['message'] ?? 'Server Error';
|
|
||||||
} else {
|
|
||||||
$message = 'Server Error: ' . $response->status();
|
|
||||||
}
|
|
||||||
throw new Exception($message);
|
throw new Exception($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,8 +189,6 @@ class Convoy extends Server
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convoy is really strict (The account password must contain 8 - 50 characters, 1 uppercase, 1 lowercase, 1 number and 1 special character.)
|
// Convoy is really strict (The account password must contain 8 - 50 characters, 1 uppercase, 1 lowercase, 1 number and 1 special character.)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user