Swiftpack.co - yhkaplan/CurlGen as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by yhkaplan.
yhkaplan/CurlGen 1.0.0
μframework for debugging with URLRequests, converting them to cURL commands
⭐️ 4
🕓 4 years ago
.package(url: "https://github.com/yhkaplan/CurlGen.git", from: "1.0.0")

CurlGen

This Swift Package is a μframework for debugging with Swift Foundation's URLRequests, converting them to cURL commands that can easily be copy and pasted to execute or inspect details.

Example:

(lldb) po request.cURLCommand()

curl -v https://www.github.com -X POST \
--data {"data": {"key": "value"}} \
--header "Accept=application/json" \
--header "Content-Type=application/json"

Prerequisites

  • Xcode 11.0 or higher

Installing

Just add the Swift Package to your Xcode project in Project settings, "Swift Packages."

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

  • Inspired by Alamofire's cURL command generator, I wanted something similar, but useable in cases where I didn't use Alamofire.

TODO

  • ☐ Put all urls, headers, and body in single quotes for shell escaping

GitHub

link
Stars: 4
Last commit: 4 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics