【问题标题】:400 Bad Request: invalid header name with curl POST request400 错误请求:带有 curl POST 请求的无效标头名称
【发布时间】:2022-11-11 07:53:06
【问题描述】:

我正在尝试向弹性搜索端点发出发布请求。 api 密钥是正确的,我从这个链接中引用:https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html 对于 api 密钥格式。 我的卷曲请求

curl -H "Authorization:ApiKey xxxxx" 
\ -H "Content-Type:application/x-ndjson 
-XPOST "https://712bbxxx/tttt/_bulk" 
--data-binary "@sss.json"

错误信息:

curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
400 Bad Request: invalid header name

我很确定引号符号和间距应该是正确的。请问您是否知道出了什么问题?

【问题讨论】:

  • 是不是因为你忘记在-H "Content-Type:application/x-ndjson 之后关闭引号?
  • 是的,谢谢

标签: curl http-headers http-post


【解决方案1】:

也许您忘记关闭内容类型标题的引号,请尝试

-H "Content-Type:application/x-ndjson"

【讨论】:

    猜你喜欢
    • 2018-09-04
    • 2016-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-03
    • 1970-01-01
    • 2014-01-22
    • 2019-05-10
    相关资源
    最近更新 更多