Skip to content

Commit

Permalink
update any object
Browse files Browse the repository at this point in the history
  • Loading branch information
tanner0101 committed Jan 26, 2016
1 parent 1b9a198 commit 6d4cae6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Sources/Response.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ public class Response {
self.init(status: status, data: data, contentType: .Text)
}

convenience init(status: Status, jsonObject: AnyObject) throws {
convenience init(status: Status, jsonObject: Any) throws {
guard let jsonObject = jsonObject as? AnyObject else {
throw SerializationError.InvalidObject
}
guard NSJSONSerialization.isValidJSONObject(jsonObject) else {
throw SerializationError.InvalidObject
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/ResponseConvertible.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extension String: ResponseConvertible {
extension Dictionary: ResponseConvertible {
public func response() -> Response {
do {
return try Response(status: .OK, jsonObject: (self as! AnyObject))
return try Response(status: .OK, jsonObject: self)
} catch {
return Response(error: "JSON serialization error: \(error)")
}
Expand Down

0 comments on commit 6d4cae6

Please sign in to comment.