generated xml , encoding issue

35 views
Skip to first unread message

kadoudal

unread,
Sep 7, 2010, 6:48:45 AM9/7/10
to Curb - Ruby libcurl Bindings
I am posting xml data :

ticket_xml = '<ticket><owned_by>FCS</owned_by><label>layout</
label><ticket_id>5040355</ticket_id></ticket>'

request = Curl::Easy.new("#{resource_uri}") do |curl|
curl.headers["X-TrackerToken"] = @token
curl.headers["Content-Type"] = 'application/xml'
end
request.http_post( Curl::PostField.content('ticket', ticket_xml))

but looking at the content display I can see that there is something
wrong with the encoding
ticket=%3Cticket%3E%3Cowned%5Fby%3EFCS%3C%2Fowned%5Fby%3E%3Clabel
%3Elayout%3C%2Flabel%3E%3Cticket%5Fid%3E5040355%3C%2Fticket%5Fid%3E

using Net::HTTP,
response = Net::HTTP.start(resource_uri.host, resource_uri.port)
do |http|
http.post(resource_uri.path, ticket_xml, {'X-TrackerToken' =>
@token, 'Content-Type' => 'application/xml'})
end

I can see the correct display
<ticket><owned_by>FCS</owned_by><label>layout</
label><ticket_id>5040355</ticket_id>

is there any additional parameter to be set in the curl.headers ?

thanks for your feedback
Reply all
Reply to author
Forward
0 new messages