Skip to content

Commit

Permalink
make JSONSerializer serialize statically
Browse files Browse the repository at this point in the history
  • Loading branch information
noppoMan committed May 21, 2017
1 parent a9df27f commit 42ff045
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Sources/Core/JSON/JSONSerializer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ private func serialize(dictionary: [String: Any]) throws -> String {
return s
}

struct JSONSerializer {
public func serialize(_ dictionary: [String: Any]) throws -> Data {
public struct JSONSerializer {
public static func serialize(_ dictionary: [String: Any]) throws -> Data {
let jsonString = try "{" + Core.serialize(dictionary: dictionary) + "}"
return jsonString.data(using: .utf8) ?? Data()
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Core/Message/Body.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ extension Body {
if jsonDictionary.isEmpty {
return nil
} else {
return try JSONSerializer().serialize(jsonDictionary)
return try JSONSerializer.serialize(jsonDictionary)
}

case .xml(let node):
Expand Down

0 comments on commit 42ff045

Please sign in to comment.