此 μ 框架将您的 NSURLRequest
对象序列化为 cURL 命令,以便您可以清楚地告诉后端人员您的代码正在执行何种 HTTP 请求。
let request: NSURLRequest
let aSession: NSURLSession
// … after you created your URL session and request, this will give you
// a cURL command that also performs this request
print(request.cURLRepresentation(withURLSession: aSession))
// alternatively, you can use this convenient proprety without a session:
print(request.cURLString)
该代码是基于 Alamofile 进行修改的。