diff --git a/src/WebhookChannel.php b/src/WebhookChannel.php index b6bd5df..742db75 100644 --- a/src/WebhookChannel.php +++ b/src/WebhookChannel.php @@ -37,7 +37,7 @@ public function send($notifiable, Notification $notification) $webhookData = $notification->toWebhook($notifiable)->toArray(); $response = $this->client->post($url, [ - 'body' => json_encode(Arr::get($webhookData, 'data')), + 'json' => Arr::get($webhookData, 'data'), 'verify' => false, 'headers' => Arr::get($webhookData, 'headers'), ]); diff --git a/tests/ChannelTest.php b/tests/ChannelTest.php index 69a3ea1..1b0c3df 100644 --- a/tests/ChannelTest.php +++ b/tests/ChannelTest.php @@ -22,7 +22,7 @@ public function it_can_send_a_notification() ->once() ->with('https://notifiable-webhook-url.com', [ - 'body' => '{"payload":{"webhook":"data"}}', + 'json' => ['payload' => ['webhook' => 'data']], 'verify' => false, 'headers' => [ 'User-Agent' => 'WebhookAgent', @@ -42,7 +42,7 @@ public function it_can_send_a_notification_with_2xx_status() ->once() ->with('https://notifiable-webhook-url.com', [ - 'body' => '{"payload":{"webhook":"data"}}', + 'json' => ['payload' => ['webhook' => 'data']], 'verify' => false, 'headers' => [ 'User-Agent' => 'WebhookAgent',