Show error
All checks were successful
Deploy App / deploy (push) Successful in 11s

This commit is contained in:
2025-08-31 22:41:48 +02:00
parent 7764af432a
commit 6a72b7150b
7 changed files with 49 additions and 39 deletions

View File

@@ -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