简体   繁体   English

从 CURL 切换到 HTTPie。 相当于 CURL -T

[英]Switching from CURL to HTTPie. Equivalent of CURL -T

I am working with cURL which is integrated into an xBase program.我正在使用集成到xBase程序中的cURL

And the curl command line by me includes the option -T to download a local file to a CalDAV calendar.我的curl命令行包括选项-T以将本地文件下载到CalDAV日历。 I tried to find it in HTTPie, but I did not find an equivalent command.我试图在 HTTPie 中找到它,但没有找到等效的命令。 Does HTTPie have such an option as -T in cURL? HTTPie在cURL中有-T这样的选项吗?

From cURL's manual:来自 cURL 的手册:

       -T, --upload-file <file>
              This transfers the specified local file to the remote URL.

It seems you are looking for the upload functionality.看来您正在寻找上传功能。 In HTTPie, depending on what the host server is expecting, you have multiple ways to upload a file:在 HTTPie 中,根据主机服务器的期望,您可以通过多种方式上传文件:

A) Redirected input : A)重定向输入

$ http PUT httpbin.org/put Content-Type:image/png < /images/photo.png

B) Request data from a filename (automatically sets the Content-Type header): B)从文件名请求数据(自动设置Content-Type标头):

$ http PUT httpbin.org/put @/images/photo.png

C) Form file upload : C)表格文件上传

$ http --form PUT httpbin.org/put photo=@/images/photo.png

Original answer by Jakub Roztocil . Jakub Roztocil的原始答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM