views:

322

answers:

2

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"?

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

Thank you in advance, Miriam

A: 

This is just a shot in the dark, but could it be as simple as changing:

-H Content-Type= text/xml

to:

-H Content-Type=text/xml

(note the change in spacing)

Ether
I just tried that. It didn't change anything. Thank you though.
Miriam Raphael Roberts
+2  A: 

I think you want to specify

-H "Content-Type:text/xml"

with a colon, not an equals.

qedi
Yep. That was it.
Miriam Raphael Roberts