【问题标题】:I cannot do a curl in webstorm我无法在 webstorm 中卷曲
【发布时间】:2021-03-22 23:37:22
【问题描述】:

大家好,所以我最近做了这个命令:

curl -X POST -H \"Content-Type: application/json\" -d '{\"password\": \"123\", \"email\": \"test@email.com\"}' http://localhost:3000/auth/create-token

我尝试不使用反斜杠,但它也不起作用。

错误信息:curl: (6) Could not resolve host: application curl: (6) Could not resolve host: "123", curl: (6) Could not resolve host: "email" curl: (3) [globbing] unmatched close brace/bracket in column 17

【问题讨论】:

  • 所有的双引号都应该被转义吗? \"Content-Type: application/json\" 是两个单独的 shell 参数,没有正确引用。例如。 '{\"password\": \"123\", \"email\": \"test@email.com\"}' 被正确引用,因此它算作一个参数。
  • 即使我这样做curl -X POST -H "Content-Type: application/json" -d '{\"password\": \"123\", \"email\": \"toto@email.com\"}' http://localhost:3000/auth/create-token 我仍然遇到同样的问题。 ://
  • 你没有删除所有的反斜杠......只需尝试curl -X POST -H "Content-Type: application/json" -d '{"password": "123", "email": "toto@email.com"}' http://localhost:3000/auth/create-token。如果这不起作用,那么你的问题有一些你没有透露的背景。

标签: javascript curl


【解决方案1】:

所以我通过到处使用双引号来解决我的问题。 curl -X POST -H "Content-Type: application/json" -d "{\"password\": \"123\", \"email\": \"toto@email.com\"}" http://localhost:3000/auth/create-token

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-02-16
    • 2012-12-15
    • 1970-01-01
    • 2019-03-01
    • 2015-12-30
    • 2019-10-14
    • 1970-01-01
    相关资源
    最近更新 更多