【发布时间】:2017-03-15 15:21:52
【问题描述】:
当我给出这样的值时,它会起作用:
curl --silent \ --insecure \ -X POST \ -d '{"Name" : "Vikram"}' \ -H "Content-Type: application/json" \ $restUrl
但是当我这样给它时:
post="'{\"Name\" : \"Vikram\"}'"
echo $post // Prints '{"Name" : "Vikram"}'
echo ${post} // Prints '{"Name" : "Vikram"}'
但以下不起作用并引发 400 错误:
curl --silent \ --insecure \ -X POST \ -d ${post} \ -H "Content-Type: application/json" \ $restUrl
【问题讨论】: