如何修复 CURL 错误"Could not resolve host"?



我试图在windows控制台上用一些json数据发出POST请求,但我得到了以下错误:

curl: (6) Could not resolve host: John,
curl: (6) Could not resolve host: lName
curl: (6) Could not resolve host: Doe,
curl: (6) Could not resolve host: phone
curl: (6) Could not resolve host: 0123456789,
curl: (6) Could not resolve host: passwd
curl: (6) Could not resolve host: myPassword,
curl: (6) Could not resolve host: tosAgm
curl: (3) [globbing] unmatched close brace/bracket in column 5
{}

请求如下:

curl -d '{"fName": "John", "lName": "Doe", "phone": "0123456789", "passwd": "myPassword", "tosAgm": "true"}' -H "Content-Type: application/json" -X POST http://localhost:3000/users

经过一些研究,我发现这个请求是正确的,那么为什么我会出现这个错误呢?如何修复?

我认为您需要转义双引号

curl -d '{"fName": "John", ...

相关内容

最新更新