美文网首页
Ubuntu下shell发送post json请求的正确姿势

Ubuntu下shell发送post json请求的正确姿势

作者: 欠儿不登 | 来源:发表于2020-11-02 14:32 被阅读0次

正确姿势

content_str="send mail test "
curl -i -X POST -H 'Content-Type':'application/json' -d '{
    "mailToList":["zhangsan@163.com"]
    "subject":"发送邮件测试",
    "content":"'${content_str}'"
}' http://ip:8080/mail/send

错误姿势:

content_str="send mail test "
curl -i -X POST -H "'Content-Type':'application/json'" -d '{
    "mailToList":["zhangsan@163.com"]
    "subject":"发送邮件测试",
    "content":"'${content_str}'"
}' http://ip:8080/mail/send

注:请求头使用方式
正确 -H 'Content-Type':'application/json'
错误 -H "'Content-Type':'application/json'"

相关文章

网友评论

      本文标题:Ubuntu下shell发送post json请求的正确姿势

      本文链接:https://www.haomeiwen.com/subject/emnrvktx.html