From 8d2ac20192745c6c74706d224c98e978aafe57dd Mon Sep 17 00:00:00 2001 From: Melvin Gundlach Date: Tue, 15 Nov 2022 17:02:25 +0100 Subject: [PATCH] Fix email send response handling The API returns 202 accepted, not 200 ok in the success case. To not break anything else, I've kept the check against .ok --- Sources/SendGridKit/SendGridClient.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/SendGridKit/SendGridClient.swift b/Sources/SendGridKit/SendGridClient.swift index be185a8..4ea154a 100644 --- a/Sources/SendGridKit/SendGridClient.swift +++ b/Sources/SendGridKit/SendGridClient.swift @@ -43,7 +43,7 @@ public struct SendGridClient { ).get() // If the request was accepted, simply return - guard response.status != .ok else { return } + guard response.status != .ok && response.status != .accepted else { return } // JSONDecoder will handle empty body by throwing decoding error let byteBuffer = response.body ?? ByteBuffer(.init())