Latest 0.0.3
Homepage https://github.com/depoon/URLRequest-cURL
License MIT
Platforms ios 10.0, requires ARC
Dependencies GzipSwift
Authors

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

Latest podspec

{
    "name": "URLRequest-cURL",
    "version": "0.0.3",
    "swift_version": "4.2",
    "summary": "Creates cURL Command from URLRequest",
    "description": "Featuresn1. Creates a cURL command that can be executed on CLIn2. cURL string can be easily imported into Postman application.",
    "homepage": "https://github.com/depoon/URLRequest-cURL",
    "license": "MIT",
    "authors": {
        "depoon": "[email protected]"
    },
    "source": {
        "git": "https://github.com/depoon/URLRequest-cURL.git",
        "tag": "0.0.3"
    },
    "platforms": {
        "ios": "10.0"
    },
    "requires_arc": true,
    "source_files": "Source/**/*",
    "dependencies": {
        "GzipSwift": []
    }
}

Pin It on Pinterest

Share This