You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行curl POST请求报错无法识别URL、Port number ended with '['及MissingRequiredBody求助

问题原因

你编写的curl命令存在参数误用问题:--request(与-X功能完全等价)的参数值只能是HTTP请求方法(如POST、GET等),你错误地将请求URL放在了--request之后,同时重复定义了请求方法,导致curl将后续的请求体内容识别为URL的一部分进行解析,才会出现端口解析报错、请求体被识别为接口路径、提示缺少请求体的问题。

修正后的命令

curl.exe -X POST "http://localhost:5000/text/analytics/v3.0-preview/sentiment" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"documents\":[{\"language\":\"en\",\"id\":\"1-en\",\"text\":\"Hello world. This is some input text that I love.\"}]}" -g

如果需要显式使用--request参数,写法如下:

curl.exe --request POST "http://localhost:5000/text/analytics/v3.0-preview/sentiment" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"documents\":[{\"language\":\"en\",\"id\":\"1-en\",\"text\":\"Hello world. This is some input text that I love.\"}]}" -g

内容的提问来源于stack exchange,提问作者grisha

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.26 02:06:07