Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save briandoll/247796 to your computer and use it in GitHub Desktop.
Save briandoll/247796 to your computer and use it in GitHub Desktop.
don't forget your headers!
# Posting XML using net/http in ruby
# This request will hang until it times out (defaulting to 60 seconds)
uri = URI.parse(SOME_SERVICE_URL)
response, data = Net::HTTP.start(uri.host, uri.port) do |h|
h.post(uri.path, some_xml)
end
# This works as expected
uri = URI.parse(SOME_SERVICE_URL)
headers = {"Content-Type" => "text/xml"}
response, data = Net::HTTP.start(uri.host, uri.port) do |h|
h.post(uri.path, some_xml, headers)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment