Skip to content

Commit

Permalink
fix(routers): fix send request with parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Hector Rondon authored and ajsb85 committed Oct 31, 2017
1 parent 8b90f41 commit d935448
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions Source/Routers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -228,18 +228,9 @@ public enum Routers: URLRequestDelegate {
}

switch self {
case .changeActiveProfile(let parameters), .changeActiveEntities(let parameters), .addItems(_, let parameters), .updateItems(_, _, let parameters), .lostPassword(let parameters):
case .changeActiveProfile(let parameters), .changeActiveEntities(let parameters), .addItems(_, let parameters), .updateItems(_, _, let parameters), .lostPassword(let parameters), .deleteItems(_, _, _, let parameters):

if let jsonData = try? JSONSerialization.data(withJSONObject: parameters, options: .prettyPrinted) {
if let jsonString = String(data: jsonData, encoding: .utf8) {
print(jsonString)
urlRequest.httpBody = jsonString.data(using: .utf8)
}
}
return urlRequest

case .deleteItems(_, _, _, let parameters):
if let jsonData = try? JSONSerialization.data(withJSONObject: parameters, options: .prettyPrinted) {
if let jsonData = try? JSONSerialization.data(withJSONObject: parameters, options: []) {
if let jsonString = String(data: jsonData, encoding: .utf8) {
print(jsonString)
urlRequest.httpBody = jsonString.data(using: .utf8)
Expand Down

0 comments on commit d935448

Please sign in to comment.