[Swift] fix GET request with array parameter (#6549)

* [Swift] fix get request with array paramters

* iOS - update pet projects
This commit is contained in:
Bruno Coelho
2020-06-05 04:39:08 +01:00
committed by GitHub
parent 388218bdf9
commit 8da06b038a
24 changed files with 1127 additions and 26 deletions

View File

@@ -55,8 +55,9 @@ public struct APIHelper {
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
if let collection = item.value as? [Any?] {
let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
result.append(URLQueryItem(name: item.key, value: value))
collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in
result.append(URLQueryItem(name: item.key, value: value))
}
} else if let value = item.value {
result.append(URLQueryItem(name: item.key, value: "\(value)"))
}