{"id":15681724,"url":"https://github.com/marcuxyz/curlify","last_synced_at":"2026-03-03T18:02:03.617Z","repository":{"id":191781493,"uuid":"685625875","full_name":"marcuxyz/curlify","owner":"marcuxyz","description":"The ruby gem converts HTTP requests to curl","archived":false,"fork":false,"pushed_at":"2024-12-04T12:08:11.000Z","size":19,"stargazers_count":17,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T04:43:19.287Z","etag":null,"topics":["curl","faraday","http","https","requests","ruby-curl","ruby-request"],"latest_commit_sha":null,"homepage":"https://github.com/marcuxyz/curlify","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcuxyz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-31T16:41:19.000Z","updated_at":"2025-03-12T22:43:10.000Z","dependencies_parsed_at":"2023-08-31T17:58:20.151Z","dependency_job_id":"692881d3-a9a9-43b9-88a4-9dc0bfd6948d","html_url":"https://github.com/marcuxyz/curlify","commit_stats":null,"previous_names":["marcuxyz/curlify"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuxyz%2Fcurlify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuxyz%2Fcurlify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuxyz%2Fcurlify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuxyz%2Fcurlify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcuxyz","download_url":"https://codeload.github.com/marcuxyz/curlify/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249192219,"owners_count":21227749,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["curl","faraday","http","https","requests","ruby-curl","ruby-request"],"created_at":"2024-10-03T16:59:15.071Z","updated_at":"2026-03-03T18:02:03.608Z","avatar_url":"https://github.com/marcuxyz.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"The gem converts ruby requests to curl\n\n## Features\n\n- **Multi-Framework Support**: Works with Faraday and Net::HTTP requests\n- **Clipboard Integration**: Copy generated curl commands directly to clipboard (macOS, Windows, Linux)\n- **Configuration Management**: YAML-based settings for customizing Curlify behavior\n- **Simple API**: Easy-to-use interface with minimal configuration required\n\n## Installation\n\nTo install the gem use `bundle` or `gem`, see:\n\n```bash\n$ gem install curlify\n```\n\nor bundle:\n\n```bash\n$ bundle add curlify\n```\n\n## Usage with faraday\n\nImport `curlify` and `faraday` and perform curlify, see:\n\n```ruby\nrequire 'faraday'\nrequire 'curlify'\n\nrequest = Faraday.new.build_request(:post) do |req|\n  req.url 'http://127.0.0.1'\nend\n\nCurlify.new(request).to_curl # \"curl -X POST -H 'User-Agent: Faraday v2.9.0'  http://127.0.0.1\"\n```\n\n## Usage with net/http\n\nImport `curlify`, `uri` and `net/http` and perform curlify, see:\n\n```ruby\nrequire 'json'\nrequire 'uri'\nrequire 'net/http'\nrequire 'curlify'\n\nuri = URI('https://httpbin.org/post')\nrequest = Net::HTTP::Post.new(uri, { 'content-type': 'application/json' })\nrequest.body = { title: 'Ruby is great :)' }.to_json\n\nCurlify.new(request).to_curl # curl -X POST -H 'content-type: application/json' -H 'accept-encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3' -H 'accept: */*' -H 'user-agent: Ruby' -H 'host: httpbin.org' -d '{\"title\":\"Ruby is great :)\"}' https://httpbin.org/post\n```\n\n## Clipboard support\n\nCurlify can copy the generated curl command directly to the operating system clipboard. To enable this behavior, pass `clipboard: true` when creating the `Curlify` instance. The method still returns the curl string.\n\nSupported platforms:\n- macOS: uses `pbcopy`\n- Windows: uses `clip`\n- Linux: uses `xclip` (must be installed and available in `PATH`)\n\nIf `xclip` is not available on Linux, Curlify will print a warning: `Curlify Warning: 'xclip' is required for clipboard support on Linux.`\n\n## Configuration\n\nCurlify supports configuration management through a YAML settings file. You can customize the default behavior by creating a `settings.yml` configuration file in your `config` directory.\n\n### Creating Your Configuration File\n\n#### Step 1: Create the config directory (if it doesn't exist)\n\n```bash\nmkdir -p config\n```\n\n#### Step 2: Create the settings.yml file\n\nCreate a file named `settings.yml` in the `config` directory:\n\n```bash\ntouch config/settings.yml\n```\n\n#### Step 3: Configure your settings\n\nOpen `config/settings.yml` and add your Curlify configuration options:\n\n```yaml\n# config/settings.yml\nclipboard: false\nverify: true\ncompressed: false\n```\n\n### Available Configuration Options\n\n- **clipboard** (boolean, default: `false`): Automatically copy generated curl commands to the clipboard\n  - `true`: Copy curl command to clipboard\n  - `false`: Only return the curl string\n\n- **verify** (boolean, default: `true`): Verify SSL certificates when making requests\n  - `true`: Verify SSL certificates\n  - `false`: Skip SSL verification (use with caution)\n\n- **compressed** (boolean, default: `false`): Add compression support to curl commands\n  - `true`: Add `--compressed` flag to curl command\n  - `false`: No compression flag\n\n### Usage Examples\n\n#### Example 1: Basic Configuration\n\n```yaml\n# config/settings.yml\nclipboard: false\nverify: true\ncompressed: false\n```\n\nThen use Curlify normally:\n\n```ruby\nrequire 'faraday'\nrequire 'curlify'\n\nrequest = Faraday.new.build_request(:post) do |req|\n  req.url 'http://127.0.0.1'\nend\n\n# Uses settings from config/settings.yml\nCurlify.new(request).to_curl\n```\n\n#### Example 2: Enable Clipboard Support\n\n```yaml\n# config/settings.yml\nclipboard: true\nverify: true\ncompressed: false\n```\n\nNow every curl command will be automatically copied to your clipboard:\n\n```ruby\nrequire 'faraday'\nrequire 'curlify'\n\nrequest = Faraday.new.build_request(:get) do |req|\n  req.url 'https://api.example.com/data'\nend\n\ncurl_command = Curlify.new(request).to_curl\n# curl_command is now in your clipboard!\nputs curl_command\n```\n\n#### Example 3: Production Configuration\n\n```yaml\n# config/settings.yml\nclipboard: false\nverify: true\ncompressed: true\n```\n\nThis configuration is suitable for production environments where you want:\n- No automatic clipboard operations\n- SSL verification enabled for security\n- Compressed curl commands\n\n### Troubleshooting\n\n- **Configuration file not found**: Make sure the `config/settings.yml` file exists in your project root directory\n- **Settings not loading**: Verify the YAML syntax is correct (indentation matters in YAML)\n- **Clipboard not working on Linux**: Ensure `xclip` is installed: `sudo apt-get install xclip`\n\nPerforming this curl command, we can see the following result:\n\n```bash\n{\n  \"args\": {},\n  \"data\": \"{\\\"title\\\":\\\"Ruby is great :)\\\"}\",\n  \"files\": {},\n  \"form\": {},\n  \"headers\": {\n    \"Accept\": \"*/*\",\n    \"Accept-Encoding\": \"gzip;q=1.0,deflate;q=0.6,identity;q=0.3\",\n    \"Content-Length\": \"28\",\n    \"Content-Type\": \"application/json\",\n    \"Host\": \"httpbin.org\",\n    \"User-Agent\": \"Ruby\",\n    \"X-Amzn-Trace-Id\": \"Root=1-64f38ad0-444dbe403f03082e14ba1d62\"\n  },\n  \"json\": {\n    \"title\": \"Ruby is great :)\"\n  },\n  \"origin\": \"xxx.xxx.xx.xx\",\n  \"url\": \"https://httpbin.org/post\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcuxyz%2Fcurlify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcuxyz%2Fcurlify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcuxyz%2Fcurlify/lists"}