卷曲设置Content-Type不正确 [英] Curl setting Content-Type incorrectly

查看:436
本文介绍了卷曲设置Content-Type不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在命令行上运行curl操作,并且无法强制标题设置为XML。我使用-H选项强制Content-Type为xml,但是,一旦我运行命令,我可以看到头以urlencoded发送,这是污染我发送的数据值之一。有人可以向我解释为什么Content-Type总是重置回application / x-www-form-urlencoded而不是application / atom + xml?

I am running a curl operation on the command line and am having trouble forcing the header to set as XML. I use the -H option to force the Content-Type to be xml, however, once I run the command I can see that the header is sent as urlencoded which is tainting one of the data values that I'm sending. Can someone explain to me why the Content-Type is always reset back to "application/x-www-form-urlencoded" instead of "application/atom+xml"?

我使用它从YouTube使用他们的API检索上传令牌。我使用类似的命令检索身份验证令牌没有问题。

I am using this to retrieve an upload token from YouTube using their API. I have no trouble retrieving an authentication token using a similar command.

curl -S -v 
--location http://gdata.youtube.com/action/GetUploadToken
-H Content-Type= text/xml
--data content=some xml content here
--data GoogleLogin auth="DQAAAHU.....TiU95NXYSLFFENTbNQUy....NjfFoC0nyEKaz-ejEkA_w"
-H X-Gdata-Key: key=AI39si5EQyo-_L......78eL80r-MooHXtrA48R82AShoQ
-H Content-Length=445


推荐答案

我想要指定

-H "Content-Type:text/xml"

,而不是等于。

这篇关于卷曲设置Content-Type不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆