【问题标题】:Curl not working when running on window cmd having curl installed, However same command works on git bash在安装了 curl 的窗口 cmd 上运行时,Curl 不起作用,但是相同的命令适用于 git bash
【发布时间】:2017-04-25 11:36:22
【问题描述】:
curl -v -X POST "ipaddress" -H 'Content-Type: application/octet-stream' -k --data-binary '@Test.png' -H 'Authorization: token'

在 git-bash 上运行上述命令时,它运行成功

但是在安装了 curl 的窗口命令行上运行时,相同的命令会失败并显示以下错误:

upload completely sent off: 14 out of 14 b
HTTP/1.1 400 Bad Request
X-Content-Type-Options: nosniff

【问题讨论】:

  • 可能是 CURL 的 windows 版本不支持您提供的确切参数,而 git-bash 的版本支持。

标签: web-services curl post odata


【解决方案1】:

用双引号替换你的单引号。 Windows cmd 不适用于单。例如:

curl -v -X POST "ipaddress" -H "Content-Type: application/octet-stream" -k --data-binary "@Test.png" -H "Authorization: token"

【讨论】:

    猜你喜欢
    • 2019-07-29
    • 1970-01-01
    • 1970-01-01
    • 2018-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-02
    • 2018-11-16
    相关资源
    最近更新 更多