json - curl: (6) 无法解析主机:—-header

标签 json rest curl watson-conversation watson

这是我的命令,我使用的是 Mac 操作系统,

curl -X POST \
-u "{username}":"{password}" —-header "Content-Type:application/json" --data "{\"input\": {\"text\": \"Turn on the lights\"}, \"context\": {\"conversation_id\": \"1b7b67c0-90ed-45dc-8508-9488bc483d5b\", \"system\": {"dialog_stack":[{"dialog_node":"root"}], \"dialog_turn_counter\": 1, \"dialog_request_counter\": 1}}}" "https://gateway.watsonplatform.net/conversation/api/v1/workspaces/25dfa8a0-0263-471b-8980-317e68c30488/message?version=2016-09-20"

当我应用这个错误日志时,

curl: (6) Could not resolve host: —-header
curl: (6) Could not resolve host: Content-Type
{"error":"Unsupported Media Type"}

请帮我解决这个问题。

提前致谢...

最佳答案

在您的 —-header 选项中,第一个字符不是普通的连字符 (U+002d)。相反,它是一个破折号 (U+2014)。将其更改为普通的连字符,事情应该会按预期工作。

关于json - curl: (6) 无法解析主机:—-header,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42063361/

相关文章:

php - 如何在 PHP/XAMPP 中启用 cURL

linux - 如何从命令行隐藏 curl 参数?

javascript - 从json数组中获取选定的 ionic 复选框

json - 如何设置一个变量等于另一个变量excel vba中的json值

c# - Web api 操作参数将空字符串参数转换为 null

java - RESTFul Web 服务 POST 示例

c - libcurl 回调函数,使用简单的接口(interface)

java - 如何区分 Spring Rest Controller 中部分更新的 null 值和未提供的值

c# - 带有列表的 asp.net 核心 ioptions

使用多线程的 Java Rest 客户端