{"id":19408446,"url":"https://github.com/4lessandrodev/curl2axios","last_synced_at":"2025-09-03T18:42:42.572Z","repository":{"id":220586824,"uuid":"752046013","full_name":"4lessandrodev/curl2axios","owner":"4lessandrodev","description":"This lib provide a interceptor to generate a curl from axios request","archived":false,"fork":false,"pushed_at":"2024-05-14T13:34:07.000Z","size":36,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-20T21:36:57.310Z","etag":null,"topics":["axios","axios-debug","curl","debug","generate-curl","testing"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/curl2axios","language":"TypeScript","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/4lessandrodev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2024-02-02T22:22:39.000Z","updated_at":"2025-02-21T17:12:48.000Z","dependencies_parsed_at":"2024-05-14T14:44:41.075Z","dependency_job_id":"7e020f96-57d9-4876-a813-0b557a1182c5","html_url":"https://github.com/4lessandrodev/curl2axios","commit_stats":null,"previous_names":["4lessandrodev/curl2axios"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/4lessandrodev/curl2axios","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4lessandrodev%2Fcurl2axios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4lessandrodev%2Fcurl2axios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4lessandrodev%2Fcurl2axios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4lessandrodev%2Fcurl2axios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/4lessandrodev","download_url":"https://codeload.github.com/4lessandrodev/curl2axios/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4lessandrodev%2Fcurl2axios/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273492400,"owners_count":25115596,"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","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["axios","axios-debug","curl","debug","generate-curl","testing"],"created_at":"2024-11-10T12:06:15.427Z","updated_at":"2025-09-03T18:42:42.540Z","avatar_url":"https://github.com/4lessandrodev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# curl2axios\n\n## Overview\n\ncurl2axios is a lightweight Axios interceptor for generating cURL commands from Axios requests. It simplifies the process of converting your Axios requests into cURL commands for easier debugging and sharing.\n\n---\n\n### Installation\n\nInstall the library using npm or yarn:\n\n```sh\n\nnpm install curl2axios\n\n\n```\n\nOR\n\n```sh\n\nyarn add curl2axios\n\n```\n\n---\n\n### Usage\n\nBasic Usage\n\n```js\n\nimport axios from 'axios';\nimport { curlInterceptor } from 'curl2axios';\n\naxios.interceptors.request.use(curlInterceptor);\n\naxios.get('https://api.com/item/1');\n\n\n```\n\nThis will automatically generate a cURL command in the console based on the Axios request.\n\n```sh\n\n{\n  occurredAt: '2024-02-02T22:17:45.514Z',\n  curlCommand: \"curl 'https://api.com/item/1' -X GET -H 'Accept: application/json, text/plain, */*' -H 'Content-Type: '\"\n}\n\n```\n\n---\n\nCustom Callback\nYou can also provide a custom callback function to handle the generated cURL command. This is useful if you want to do something specific with the command, such as logging it in a different way.\n\n```js\n\nimport axios from 'axios';\nimport { curlInterceptor } from 'curl2axios';\n\nconst myCallback = (curl: string) =\u003e console.log(curl);\n\naxios.interceptors.request.use((req) =\u003e curlInterceptor(req, myCallback));\n\naxios.get('https://api.com/item/1');\n\n\n```\n\nIn this example, the custom callback function myCallback will be called with the generated cURL command.\n\n### Example Output\n\nFor the given Axios request:\n\n```js\n\naxios.get('https://api.com/item/1');\n\n// curl 'https://api.com/item/1' -X GET -H 'Accept: application/json, text/plain, */*' -H 'Content-Type: '\n\n\n```\n\n### Bind\n\n```js\n\nimport axios from 'axios';\nimport { bindCurl } from 'curl2axios';\n\nconst instance = bindCurl(axios.create({ baseURL: 'https://pokeapi.co/api/v2' }));\n\nawait instance.get('/berry-flavor/1');\n\nconsole.log(instance.curl);\n\n// \u003e \"curl '/berry-flavor/1' -X GET -H 'Accept: application/json, text/plain, */*' -H 'Content-Type: ' --url 'https://pokeapi.co/api/v2'\"\n\n```\n\n### License\n\naxios2curl is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F4lessandrodev%2Fcurl2axios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F4lessandrodev%2Fcurl2axios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F4lessandrodev%2Fcurl2axios/lists"}