From 486646c03e89d1ba6ecbf91f05d7b22870cfca8f Mon Sep 17 00:00:00 2001 From: Florian Weich Date: Thu, 31 May 2018 01:57:32 +0200 Subject: [PATCH] Removed adding the prefix 'key-' if not there There exist API keys without the leading 'key-' characters --- Sources/Mailgun/Mailgun.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sources/Mailgun/Mailgun.swift b/Sources/Mailgun/Mailgun.swift index afe2cc3..190d8b5 100644 --- a/Sources/Mailgun/Mailgun.swift +++ b/Sources/Mailgun/Mailgun.swift @@ -87,8 +87,7 @@ public struct Mailgun: MailgunProvider { fileprivate extension Mailgun { func encode(apiKey: String) throws -> String { - let key = apiKey.contains("key-") ? apiKey : "key-\(apiKey)" - guard let apiKeyData = "api:\(key)".data(using: .utf8) else { + guard let apiKeyData = "api:\(apiKey)".data(using: .utf8) else { throw MailgunError.encodingProblem } let authKey = apiKeyData.base64EncodedData()