在安装了 curl 的窗口 cmd 上运行时,curl 不起作用,但是相同的命令适用于 git bash

J.v*_*vik 1 post curl web-services odata

curl -v -X POST "ipaddress" -H 'Content-Type: application/octet-stream' -k --data-binary '@Test.png' -H 'Authorization: token'
Run Code Online (Sandbox Code Playgroud)

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

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

upload completely sent off: 14 out of 14 b
HTTP/1.1 400 Bad Request
X-Content-Type-Options: nosniff
Run Code Online (Sandbox Code Playgroud)

Sab*_*san 5

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

curl -v -X POST "ipaddress" -H "Content-Type: application/octet-stream" -k --data-binary "@Test.png" -H "Authorization: token"
Run Code Online (Sandbox Code Playgroud)