curl在windows下和linux中使用的一个区别


  最近在windows环境下的cmd中,使用curl测试post接口,总是报Failed to decode JSON object的错误。

 

  同样的命令在windows环境的git bash窗口中执行是好的。git bash可以模拟linux环境下一些命令的输入效果。  特别是scp命令给linux上传文件,或者从linux上下载文件件时很方便。 

 

  windows环境中,curl命令中的双引号需要使用"\"来进行转义。

  例如,curl -v 127.0.0.1://test/pools -X POST -H "Content-Type: application/json"   -d  '{"message":"test"}'

  要加上转义:

  curl -v 127.0.0.1://test/pools -X POST -H "Content-Type: application/json"   -d  '{\"message\":\"tes\t"}'

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM