Skip to content

Commit

Permalink
Stop using instance based encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Bachar committed Jul 22, 2024
1 parent 8392353 commit 06b0977
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Airship/AirshipCore/Source/ChannelAPIClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ final class ChannelAPIClient: ChannelAPIClientProtocol, Sendable {

private let config: RuntimeConfig
private let session: AirshipRequestSession
private let encoder: JSONEncoder = JSONEncoder()

init(
config: RuntimeConfig,
Expand Down Expand Up @@ -46,7 +45,7 @@ final class ChannelAPIClient: ChannelAPIClientProtocol, Sendable {
payload: ChannelRegistrationPayload
) async throws -> AirshipHTTPResponse<ChannelAPIResponse> {
let url = try makeURL(path: self.channelPath)
let data = try encoder.encode(payload)
let data = try JSONEncoder().encode(payload)

AirshipLogger.debug(
"Creating channel with: \(payload)"
Expand Down Expand Up @@ -100,7 +99,7 @@ final class ChannelAPIClient: ChannelAPIClientProtocol, Sendable {
) async throws -> AirshipHTTPResponse<ChannelAPIResponse> {

let url = try makeChannelLocation(channelID: channelID)
let data = try encoder.encode(payload)
let data = try JSONEncoder().encode(payload)

AirshipLogger.debug(
"Updating channel \(channelID) with: \(payload)"
Expand Down

0 comments on commit 06b0977

Please sign in to comment.