Skip to content

Commit

Permalink
Merge pull request #15 from noppoMan/encode-data-to-base64
Browse files Browse the repository at this point in the history
Encode data type value as base64
  • Loading branch information
noppoMan authored May 11, 2017
2 parents 4fdf94e + 7266ea7 commit 2e52f69
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions Sources/Core/Serializer/JSONSerializer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ extension UInt16 : NumericType { }
extension UInt32 : NumericType { }
extension UInt64 : NumericType { }


enum JSONSerializerError: Error {
case unserializableType(String)
}

private func serialize(value: Any) throws -> String {
var s = ""
switch value {
Expand All @@ -54,8 +49,8 @@ private func serialize(value: Any) throws -> String {
case let v as Bool:
s += "\(v)".lowercased()

case _ as Data:
throw JSONSerializerError.unserializableType("Data")
case let v as Data:
s += dquote(v.base64EncodedString())

default:
s += dquote("\(value)")
Expand Down

0 comments on commit 2e52f69

Please sign in to comment.