
Linux和Windows下使用curl命令格式差异
问题:
Linux下使用curl命令成功,在window下使用却报错:
400 Bad Request: Failed to decode JSON object: Expecting value: line 1
解决方法:
由于单引号在Linux和Windows的含义不同,curl调用格式也略有差异。Windows下双引号內部使用双引号需要"\\"转义。
Linux下curl格式:
curl -d '{"auth_url": "IP:5000/v2.0","user": "user_name","key": "password","tenant_name": "tenantname"}' -H "Content-Type: application/json" -X POST IP:5000/swift/api/v1.0/tokenWindows下curl格式:
curl -d "{\\"auth_url\\": \\"IP:5000/v2.0\\",\\"user\\": \\"user_name\\",\\"key\\": \\"password\\",\\"tenant_name\\": \\"tenantname\\"}" -H "Content-Type: application/json" -X POST IP:5000/swift/api/v1.0/token
👁️ 阅读量:0
© 版权声明:本文《Linux和Windows下使用curl命令格式差异》内容均为本站精心整理或网友自愿分享,如需转载请注明原文出处:https://www.zastudy.cn/wen/1686884754a370147.html。