看了下 Alamofire 源代码, JSON 参数序列化如下:
case .JSON:
do {
let options = NSJSONWritingOptions()
let data = try NSJSONSerialization.dataWithJSONObject(parameters, options: options)
if mutableURLRequest.valueForHTTPHeaderField("Content-Type") == nil {
mutableURLRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
}
mutableURLRequest.HTTPBody = data
} catch {
encodingError = error as NSError
}
是 NSJSONSerialization.dataWithJSONObject 的问题吧,貌似没有很优雅的解决方案
http://stackoverflow.com/questions/19651009/how-to-prevent-nsjsonserialization-from-adding-extra-escapes-in-url