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

Commit

Permalink
message: Fix up an issue with JSONEncoder and the HTTPBody
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonycastelli committed Apr 26, 2018
1 parent da39a75 commit a561798
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 24 deletions.
71 changes: 49 additions & 22 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,44 @@
"repositoryURL": "https://github.com/vapor/console.git",
"state": {
"branch": null,
"revision": "038e30ec9004fb1915d14d964a3facc1ec5c80f4",
"version": "3.0.0"
"revision": "30f102dcf4d18862a14df9f65c4b91d117005926",
"version": "3.0.1"
}
},
{
"package": "Core",
"repositoryURL": "https://github.com/vapor/core.git",
"state": {
"branch": null,
"revision": "5383e40f19d71da99e496afa9972c085abc2379d",
"version": "3.0.2"
"revision": "71722db60bcd94532d5ff5894b85d697e6e27db8",
"version": "3.1.3"
}
},
{
"package": "Crypto",
"repositoryURL": "https://github.com/vapor/crypto.git",
"state": {
"branch": null,
"revision": "e77aa181580b466fb26865918b62973d9fbfaed6",
"version": "3.0.0"
"revision": "346ae2b2ea65a4b6f4985a8e8cb25cf61da549d8",
"version": "3.1.1"
}
},
{
"package": "DatabaseKit",
"repositoryURL": "https://github.com/vapor/database-kit.git",
"state": {
"branch": null,
"revision": "e594e658cc001e04b8d4ad13881d8714c510f94f",
"version": "1.0.0-rc.2.2.2"
"revision": "c4e4f08b83a2407989332f970d6447de07ee7b91",
"version": "1.0.0"
}
},
{
"package": "Engine",
"repositoryURL": "https://github.com/vapor/engine.git",
"package": "HTTP",
"repositoryURL": "https://github.com/vapor/http.git",
"state": {
"branch": null,
"revision": "4846ea9abeb04863f82f618ee8cb22650a82ae3c",
"version": "3.0.0-rc.2.1.1"
"revision": "f934c1391c370fbf529bd461b40aa75ce40ce1e5",
"version": "3.0.2"
}
},
{
Expand All @@ -55,13 +55,22 @@
"version": "3.0.0-rc.2.1.1"
}
},
{
"package": "Multipart",
"repositoryURL": "https://github.com/vapor/multipart.git",
"state": {
"branch": null,
"revision": "7778dcb62f3efa845e8e2808937bb347575ba7ce",
"version": "3.0.1"
}
},
{
"package": "Routing",
"repositoryURL": "https://github.com/vapor/routing.git",
"state": {
"branch": null,
"revision": "2fc1d4de22a54848b35ad17b3e7f7816f19ebf90",
"version": "3.0.0-rc.2"
"revision": "3219e328491b0853b8554c5a694add344d2c6cfb",
"version": "3.0.1"
}
},
{
Expand All @@ -78,8 +87,8 @@
"repositoryURL": "https://github.com/apple/swift-nio.git",
"state": {
"branch": null,
"revision": "a0b7f646fba61402da384b3202f54c27debb5e13",
"version": "1.3.1"
"revision": "902b18df16897da644724bd4b85b4bbe952ac9c6",
"version": "1.5.1"
}
},
{
Expand Down Expand Up @@ -114,26 +123,44 @@
"repositoryURL": "https://github.com/vapor/template-kit.git",
"state": {
"branch": null,
"revision": "61ed3d3b0df4c181d6b88e06b418f425978ac2af",
"version": "1.0.0-rc.2.0.3"
"revision": "43b57b5861d5181b906ac6411d28645e980bb638",
"version": "1.0.1"
}
},
{
"package": "URLEncodedForm",
"repositoryURL": "https://github.com/vapor/url-encoded-form.git",
"state": {
"branch": null,
"revision": "8448fa943057c01220f6a940d3b1b8e9fd92a96e",
"version": "1.0.2"
}
},
{
"package": "Validation",
"repositoryURL": "https://github.com/vapor/validation.git",
"state": {
"branch": null,
"revision": "1ce87fc2d18a8f15a491805825063c8db493a51e",
"version": "2.0.0-rc.2.1.1"
"revision": "ab6c5a352d97c8687b91ed4963aef8e7cfe0795b",
"version": "2.0.0"
}
},
{
"package": "Vapor",
"repositoryURL": "https://github.com/vapor/vapor.git",
"state": {
"branch": null,
"revision": "c045b8d02e6a135f055e879a9fa789026a0b4e9d",
"version": "3.0.0-rc.2.2.4"
"revision": "c834f9495ff5ab9768b74f5822ff23d795e36922",
"version": "3.0.0-rc.2.8.1"
}
},
{
"package": "WebSocket",
"repositoryURL": "https://github.com/vapor/websocket.git",
"state": {
"branch": null,
"revision": "23acd21aa37a200faa2f5d5525c974efa6b5676c",
"version": "1.0.0"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions Sources/APNS/Message.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public struct Message {
/// Use the development or production servers
public let development: Bool


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

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

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

0 comments on commit a561798

Please sign in to comment.