Skip to content
This repository was archived by the owner on Jun 5, 2024. It is now read-only.

Commit a561798

Browse files
message: Fix up an issue with JSONEncoder and the HTTPBody
1 parent da39a75 commit a561798

2 files changed

Lines changed: 51 additions & 24 deletions

File tree

Package.resolved

Lines changed: 49 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/APNS/Message.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public struct Message {
5656
/// Use the development or production servers
5757
public let development: Bool
5858

59-
59+
/// Creates a new message
6060
public init(priority: Priority = .immediately, profile: Profile, deviceToken: String, payload: Payload, on container: Container, development: Bool = false) throws {
6161
self.profile = profile
6262
self.priority = priority
@@ -89,7 +89,7 @@ public struct Message {
8989
}
9090

9191
let encoder = JSONEncoder()
92-
request.http.body = try encoder.encodeBody(from: PayloadContent(payload: self.payload))
92+
request.http.body = try HTTPBody(data: encoder.encode(PayloadContent(payload: self.payload)))
9393

9494
if self.development {
9595
guard let url = URL(string: "https://api.development.push.apple.com/3/device/\(self.deviceToken)") else {

0 commit comments

Comments
 (0)