Skip to content

Commit

Permalink
remove base64 encoding cause it's no longer required
Browse files Browse the repository at this point in the history
  • Loading branch information
zihejia committed Jan 11, 2022
1 parent 6af414a commit 3595189
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions Sources/JSONHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,12 @@ class JSONHandler {
class func encodeAPIData(_ obj: MPObjectToParse) -> String? {
let data: Data? = serializeJSONObject(obj)

guard let d = data else {
guard let data = data else {
Logger.warn(message: "couldn't serialize object")
return nil
}

let base64Encoded = d.base64EncodedString(options: .lineLength64Characters)

guard let b64 = base64Encoded
.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed) else {
Logger.warn(message: "couldn't replace characters to allowed URL character set")
return nil
}

return b64
return String(decoding: data, as: UTF8.self)
}

class func deserializeData(_ data: Data) -> MPObjectToParse? {
Expand Down

0 comments on commit 3595189

Please sign in to comment.