不支持Curl错误协议
我试图通过生成RESTAPI从nexus存储库创建的组件中删除组件不支持Curl错误协议,curl,cmd,Curl,Cmd,我试图通过生成RESTAPI从nexus存储库创建的组件中删除组件 curl -X DELETE --header 'Accept: application/json' 'http://localhost:8081/service/siesta/rest/beta/components/sam' 我发现以下错误: curl: (6) Could not resolve host: application curl: (1) Protocol "'http" not supported or d
curl -X DELETE --header 'Accept: application/json' 'http://localhost:8081/service/siesta/rest/beta/components/sam'
我发现以下错误:
curl: (6) Could not resolve host: application
curl: (1) Protocol "'http" not supported or disabled in libcurl
Windows cmd命令提示符不支持单引号(')。您必须对该shell使用双引号(“)
您使用的单引号不会被shell剥离,而是传递给curl,curl将它们作为参数的一部分读取,这当然不是您想要的
因此,您的命令行应该这样编写:
curl -X DELETE --header "Accept: application/json" "http://localhost:8081/service/siesta/rest/beta/components/sam"
或者,使用支持单引号的shell/系统。请详细说明我使用的版本是否错误尝试在windows命令行上双引号引用URL。它不支持用单引号括起那样的字符串。感谢Drew的回复,因为您告诉我在URL curl-X DELETE--header中添加了双引号Accept:application/json''s“现在我得到了这些错误任何想法:(6)无法解析主机:application所以对
Accept:application/json
部分使用双引号。Daniel感谢您的回复,这是正确的,我是否遗漏了任何东西我更新了我的答案,以说明如何使用双引号而不是单引号。