URLRequest-cURL 0.0.3

URLRequest-cURL 0.0.3

Maintained by Kenneth Poon.



  • By
  • depoon

URLRequest-cURL

URLRequest extension that creates a cURL command string

Installation

CocoaPods

URLRequest-cURL is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'URLRequest-cURL'

Example on how to use

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

Simple var 'cURL' gives the following string:

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"
}'

You can also choose to ommit http headers

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

function 'cURL' ommitting headers gives the following string:

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