lib/jenkins/api.rb in jenkins-0.6.2 vs lib/jenkins/api.rb in jenkins-0.6.3

- old
+ new

@@ -202,13 +202,19 @@ def self.delete_node(name) post_plain("#{base_uri}/computer/#{CGI::escape(name).gsub('+', '%20')}/doDelete/api/json") end # Helper for POST that don't barf at Jenkins's crappy API responses - def self.post_plain(path, options = {}) + def self.post_plain(path, data = "", options = {}) options = options.with_clean_keys uri = URI.parse base_uri - res = Net::HTTP.start(uri.host, uri.port) { |http| http.post(path, options) } + res = Net::HTTP.start(uri.host, uri.port) do |http| + if RUBY_VERSION =~ /1.8/ + http.post(path, options) + else + http.post(path, data, options) + end + end end # Helper for GET that don't barf at Jenkins's crappy API responses def self.get_plain(path, options = {}) options = options.with_clean_keys