Skip to content

Commit

Permalink
Make internal code clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
fpseverino committed Dec 15, 2024
1 parent 78aa7ba commit ce0de35
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/SendGridKit/SendGridClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ public struct SendGridClient: Sendable {

public func send<DynamicTemplateData: Codable & Sendable>(email: SendGridEmail<DynamicTemplateData>) async throws {
var headers = HTTPHeaders()
headers.add(name: "Authorization", value: "Bearer \(apiKey)")
headers.add(name: "Authorization", value: "Bearer \(self.apiKey)")
headers.add(name: "Content-Type", value: "application/json")

var request = HTTPClientRequest(url: apiURL)
var request = HTTPClientRequest(url: self.apiURL)
request.method = .POST
request.headers = headers
request.body = try HTTPClientRequest.Body.bytes(encoder.encode(email))
request.body = try HTTPClientRequest.Body.bytes(self.encoder.encode(email))

let response = try await httpClient.execute(request, timeout: .seconds(30))
let response = try await self.httpClient.execute(request, timeout: .seconds(30))

// If the request was accepted, simply return
if (200...299).contains(response.status.code) { return }
Expand Down

0 comments on commit ce0de35

Please sign in to comment.