This commit is contained in:
@@ -19,27 +19,23 @@ class GenericApi implements BotContract
|
||||
|
||||
public function run(): void
|
||||
{
|
||||
try {
|
||||
$this->client = new Client();
|
||||
$this->client = new Client();
|
||||
|
||||
$options = [];
|
||||
$options = [];
|
||||
|
||||
if (!empty($this->config['headers'])) {
|
||||
$options['headers'] = json_decode($this->config['headers'], true);
|
||||
}
|
||||
|
||||
if (!empty($this->config['body'])) {
|
||||
$options['json'] = json_decode($this->config['body'], true);
|
||||
}
|
||||
|
||||
$this->client->request(
|
||||
$this->config['method'] ?? 'GET',
|
||||
$this->config['url'],
|
||||
$options
|
||||
);
|
||||
} catch (GuzzleException $e) {
|
||||
Log::error("Call to {$this->config['url']} failed" . $e->getMessage());
|
||||
if (!empty($this->config['headers'])) {
|
||||
$options['headers'] = json_decode($this->config['headers'], true);
|
||||
}
|
||||
|
||||
if (!empty($this->config['body'])) {
|
||||
$options['json'] = json_decode($this->config['body'], true);
|
||||
}
|
||||
|
||||
$this->client->request(
|
||||
$this->config['method'] ?? 'GET',
|
||||
$this->config['url'],
|
||||
$options
|
||||
);
|
||||
}
|
||||
|
||||
public static function configSchema(): array
|
||||
|
||||
Reference in New Issue
Block a user