From 8b0150735947c1dbafff8a35be0ab640b365f184 Mon Sep 17 00:00:00 2001 From: Bjorn Antonissen Date: Mon, 24 Nov 2025 14:08:10 +0100 Subject: [PATCH] feat(send): clear payload and idempotency key after sending After sending an email, the payload and idempotency key are now cleared to prevent unintended reuse in subsequent requests. --- src/Endpoints/EmailEndpoint.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Endpoints/EmailEndpoint.php b/src/Endpoints/EmailEndpoint.php index 966bd56..0904b94 100644 --- a/src/Endpoints/EmailEndpoint.php +++ b/src/Endpoints/EmailEndpoint.php @@ -217,6 +217,11 @@ public function send(): array $headers['Idempotency-Key'] = $this->idempotencyKey; } - return $this->httpClient->post('/v1/send', $this->payload, $headers); + $result = $this->httpClient->post('/v1/send', $this->payload, $headers); + + $this->payload = []; + $this->idempotencyKey = null; + + return $result; } }