.StatusOK-cURL 0.0.3

.StatusOK-cURL 0.0.3

Kenneth Poon维护。



  • depoon

增广URLRequest以生成cURL命令字符串

CocoaPods

.StatusOK-cURL通过CocoaPods提供。要安装它,只需将以下行添加到Podfile中

pod 'URLRequest-cURL'

// let request = URLRequest()
print(request.cURL)

简单的变量'cURL'返回以下字符串

curl -X POST 'https://www.anonymousapi.com/checksPassword?apikey=XXYYZZ' -H 'Accept-Language: en' -H 'Content-Length: 91' -H 'Content-Type: application/json' -d '{
  "email" : "[email protected]",
  "returnSecureToken" : true,
  "password" : "password"
}'

您也可以选择省略http头部信息

// let request = URLRequest()
print(request.cURL(withHeaders: false))

省略头部信息的'cURL'函数返回以下字符串

curl -X POST 'https://www.anonymousapi.com/checksPassword?apikey=XXYYZZ' -d '{
  "email" : "[email protected]",
  "returnSecureToken" : true,
  "password" : "password"
}'