解决postman/apifox成功调用python的flask接口但curl调用失败的问题
现发现部分环境下部署的flask服务不支持如:
curl -H "Content-Type:application/json" -X POST "http://xxx.x.x.x:xxxx" -d "{json格式的参数字典}"
一类的指令,会显示400 Bad Request The browser (or proxy) sent a request that this server could not understand.等错误。但是通过postman/apifox等api工具能够正常对接口进行传参和调用。
解决方法:
将curl语句进行如下修改:
curl --request POST "http://xxx.x.x.x:xxxx" --header "Content-Type:application/json" --data "{json格式的参数字典}"
即可实现正常传参和调用。