mirror of
https://github.com/pelican-dev/panel.git
synced 2026-07-15 21:48:08 +03:00
Fix webhook payload serialization and null headers
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Enums\WebhookType;
|
||||
use App\Models\WebhookConfiguration;
|
||||
use Exception;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
@@ -34,7 +35,9 @@ class ProcessWebhook implements ShouldQueue
|
||||
$data = reset($data);
|
||||
}
|
||||
|
||||
if (is_object($data)) {
|
||||
if ($data instanceof Arrayable) {
|
||||
$data = $data->toArray();
|
||||
} elseif (is_object($data)) {
|
||||
$data = get_object_vars($data);
|
||||
}
|
||||
|
||||
@@ -64,7 +67,7 @@ class ProcessWebhook implements ShouldQueue
|
||||
$headers = [];
|
||||
|
||||
if ($this->webhookConfiguration->type === WebhookType::Regular) {
|
||||
foreach ($this->webhookConfiguration->headers as $key => $value) {
|
||||
foreach ($this->webhookConfiguration->headers ?? [] as $key => $value) {
|
||||
$headers[$key] = $this->webhookConfiguration->replaceVars($data, $value);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user