我正在执行以下curl命令并收到错误消息:
curl -Method Post -Header @{'Content-Type'='application/x-www-form-urlencoded'}-Body @{grant_type = 'password';username = 'abcd';password = 'xyz'} "http://someaddress/api/oauth/token" -O test_curl
请问我在这里做错什么了吗?
错误:
Warning: built-in manual was disabled at build-time!
curl: option -Method: is unknown
curl: try 'curl --help' for more information
答案 0 :(得分:1)
-Method
选项应为-X
或--request
。 -Header
选项应为-H
或--header
。另外,您必须使用双引号将带有单引号的JSON标头传递到curl
。
尝试一下:
curl -XPOST -H "@{'Content-Type'='application/x-www-form-urlencoded'}-Body @{grant_type = 'password';username = 'abcd';password = 'xyz'}" -o test_curl "http://someaddress/api/oauth/token"