Skip to content

Commit f5146b7

Browse files
authored
Merge pull request #1 from sahglie/master
Improve compatibility with RestClient 2.x
2 parents 61f8dcd + 0a8277b commit f5146b7

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

rt_client.rb

+3-5
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
class RT_Client
4040

41-
UA = "Mozilla/5.0 ruby RT Client Interface 1.0.0"
41+
UA = "Mozilla/5.0 ruby RT Client Interface 1.0.1"
4242
attr_reader :status, :site, :version, :cookies, :server, :user, :cookie
4343

4444
# Create a new RT_Client object. Load up our stored cookie and check it.
@@ -70,7 +70,6 @@ class RT_Client
7070
# pass=<RT password>
7171
# cookies=<directory>
7272
def initialize(*params)
73-
@boundary = "----xYzZY#{rand(1000000).to_s}xYzZY"
7473
@version = "1.0.0"
7574
@status = "Not connected"
7675
@server = "http://localhost/"
@@ -138,8 +137,7 @@ def initialize(*params)
138137
end
139138

140139
headers = { 'User-Agent' => UA,
141-
'Content-Type' => "multipart/form-data; boundary=#{@boundary}",
142-
'Cookie' => @cookie }
140+
'Cookie' => @cookie }
143141
@site = RestClient::Resource.new(@resource, :headers => headers, :verify_ssl => false)
144142
@status = data
145143
self.untaint
@@ -783,7 +781,7 @@ def inspect # :nodoc:
783781

784782
# helper to convert responses from RT REST to a hash
785783
def response_to_h(resp) # :nodoc:
786-
resp.gsub!(/RT\/\d+\.\d+\.\d+\s\d{3}\s.*\n\n/,"") # toss the HTTP response
784+
resp = resp.body.gsub(/RT\/\d+\.\d+\.\d+\s\d{3}\s.*\n\n/,"") # toss the HTTP response
787785

788786
# unfold folded fields
789787
# A newline followed by one or more spaces is treated as a

0 commit comments

Comments
 (0)