I've been messing with Net::Http using something like below, with
variations (Base64.encode64) but nothing works yet. Anyone know the
ruby equivlent to the curl version above?
Thanks!
# NOT WORKING:
my_url = 'http://localhost:8080/update'
data = File.read('my_data.xml')
url = URI.parse(my_url)
post = Net::HTTP::Post.new(url.path)
post.body = data
post.content_type = 'application/x-www-form-urlencoded; charset=utf-8'
response = Net::HTTP.start(url.host, url.port) do |http|
http.request(post)
end
puts response.body
I've been messing with Net::Http using something like below, with
variations (Base64.encode64) but nothing works yet. Anyone know the
ruby equivlent to the curl version above?
Thanks!
# NOT WORKING:
my_url = 'http://localhost:8080/update'
data = File.read('my_data.xml')
url = URI.parse(my_url)
post = Net::HTTP::Post.new(url.path)
post.body = data
post.content_type = 'application/x-www-form-urlencoded; charset=utf-8'
response = Net::HTTP.start(url.host, url.port) do |http|
http.request(post)
end
puts response.body