diff --git a/src/Event.php b/src/Event.php index c8f9cc1..1862ab7 100644 --- a/src/Event.php +++ b/src/Event.php @@ -9,7 +9,7 @@ * * @package Hawk */ -final class Event +final class Event implements \JsonSerializable { /** * @var string @@ -53,7 +53,7 @@ public function getEventPayload(): EventPayload /** * @return array */ - public function jsonSerialize() + public function jsonSerialize(): array { return [ 'token' => $this->integrationToken, diff --git a/src/Transport/CurlTransport.php b/src/Transport/CurlTransport.php index 07d63cc..797a6e4 100644 --- a/src/Transport/CurlTransport.php +++ b/src/Transport/CurlTransport.php @@ -53,7 +53,7 @@ public function send(Event $event) $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $this->url); curl_setopt($curl, CURLOPT_POST, 1); - curl_setopt($curl, CURLOPT_POSTFIELDS, $event->jsonSerialize()); + curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($event, JSON_UNESCAPED_UNICODE)); curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_TIMEOUT, 10);