Created
December 3, 2009 00:59
-
-
Save briandoll/247796 to your computer and use it in GitHub Desktop.
don't forget your headers!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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