rest-client 1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rest-client might be problematic. Click here for more details.
- data/README.rdoc +1 -1
- data/Rakefile +1 -1
- data/lib/restclient/request.rb +1 -1
- data/spec/request_spec.rb +6 -0
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -141,7 +141,7 @@ Patches contributed by: Chris Anderson, Greg Borenstein, Ardekantur, Pedro
|
|
141
141
|
Belo, Rafael Souza, Rick Olson, Aman Gupta, Blake Mizerany, Brian Donovan, Ivan
|
142
142
|
Makfinsky, Marc-André Cournoyer, Coda Hale, Tetsuo Watanabe, Dusty Doris,
|
143
143
|
Lennon Day-Reynolds, James Edward Gray II, Cyril Rohr, Juan Alvarez, and Adam
|
144
|
-
Jacob
|
144
|
+
Jacob, and Paul Dlug
|
145
145
|
|
146
146
|
Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
|
147
147
|
|
data/Rakefile
CHANGED
data/lib/restclient/request.rb
CHANGED
@@ -213,7 +213,7 @@ module RestClient
|
|
213
213
|
end
|
214
214
|
|
215
215
|
def response_log(res)
|
216
|
-
size = @raw_response ? File.size(@tf.path) : res.body.size
|
216
|
+
size = @raw_response ? File.size(@tf.path) : (res.body.nil? ? 0 : res.body.size)
|
217
217
|
"# => #{res.code} #{res.class.to_s.gsub(/^Net::HTTP/, '')} | #{(res['Content-type'] || '').gsub(/;.*$/, '')} #{size} bytes"
|
218
218
|
end
|
219
219
|
|
data/spec/request_spec.rb
CHANGED
@@ -278,6 +278,12 @@ describe RestClient::Request do
|
|
278
278
|
@request.response_log(res).should == "# => 200 OK | 4 bytes"
|
279
279
|
end
|
280
280
|
|
281
|
+
it "logs a response with a nil body" do
|
282
|
+
res = mock('result', :code => '200', :class => Net::HTTPOK, :body => nil)
|
283
|
+
res.stub!(:[]).with('Content-type').and_return('text/html; charset=utf-8')
|
284
|
+
@request.response_log(res).should == "# => 200 OK | text/html 0 bytes"
|
285
|
+
end
|
286
|
+
|
281
287
|
it "strips the charset from the response content type" do
|
282
288
|
res = mock('result', :code => '200', :class => Net::HTTPOK, :body => 'abcd')
|
283
289
|
res.stub!(:[]).with('Content-type').and_return('text/html; charset=utf-8')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Wiggins
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-12 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|