跳到主要内容

cURL 转代码

UpBox优盒工具箱,免费在线 cURL 转代码工具,把 cURL 命令解析成 fetch 或 axios 请求,支持请求头、Cookie、Basic Auth、JSON 请求体与多行续行。

无需注册 · 数据不上传No sign-up · nothing uploaded

cURL 命令cURL command

请求方法—
请求头—
请求体—

请求代码Request code

粘贴 cURL 命令后自动转换

生成代码不会发起真实请求,令牌与 Cookie 请自行确认是否保留

本工具所有运算在本地浏览器完成,你的文件、文本不会上传到服务器

工具介绍

把浏览器 DevTools 里复制的 cURL 命令粘进来,工具会解析请求方法、URL、请求头与请求体,输出 fetch 或 axios 代码。 Paste a cURL copied from DevTools and the tool parses method, URL, headers and body into fetch or axios code.

支持反斜杠换行、单双引号、`-u` Basic Auth、`-b` Cookie 与多个 `-H`,生成的代码不会真的发出请求。 Backslash continuations, single/double quotes, -u Basic auth, -b cookies and multiple -H headers are supported; the generated code never sends a request.

  • fetch / axiosfetch / axios
  • 请求头解析Header parsing
  • Basic Auth 与 CookieBasic auth and cookies
  • 多行命令Multi-line commands
  • 本地处理Local processing

使用说明

  1. 粘贴 cURL 命令。Paste the cURL command.
  2. 选择 fetch 或 axios。Choose fetch or axios.
  3. 检查生成的 URL、头与请求体。Review the URL, headers and body.
  4. 复制代码或下载 .js。Copy the code or download a .js file.

常见问题

为什么提示部分参数不支持?Why are some flags unsupported?
`-F` 表单上传与 `--upload-file` 暂未转换,会保留其余参数并提示。Form uploads (-F) and --upload-file are not converted yet; other flags still work with a notice.
代码会泄露令牌吗?Will my token leak?
不会上传,但生成的代码会原样包含命令里的 Authorization 与 Cookie,分享前请自行删除。Nothing is uploaded, but generated code keeps Authorization and cookies from the command — strip them before sharing.
能直接运行吗?Can I run it directly?
fetch 版本可直接在浏览器或 Node 18+ 运行;axios 版本需要先安装 axios。The fetch version runs in browsers or Node 18+; axios needs the package installed.
支持 Windows 的 ^ 续行吗?Does Windows ^ continuation work?
支持,反斜杠与 `^` 换行都会被合并。Yes, both backslash and ^ line breaks are merged.
广告位

此处为广告位,可放置你的推广素材

支持图片、文字或 HTML 代码,替换本区块内容即可投放

浏览其他分类