aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/lib/active_resource
diff options
context:
space:
mode:
authorMike Abner <mike.abner@gmail.com>2010-07-07 14:23:16 -0700
committerJosé Valim <jose.valim@gmail.com>2010-09-18 20:49:45 +0200
commit154081f0f74988bdb8979f0447ff5816ab83d8fd (patch)
treeac4e435f9bc7df7278f39d54dca8fff230a67754 /activeresource/lib/active_resource
parent39debfc854c782f263a8340b63c9d8892f92a94b (diff)
downloadrails-154081f0f74988bdb8979f0447ff5816ab83d8fd.tar.gz
rails-154081f0f74988bdb8979f0447ff5816ab83d8fd.tar.bz2
rails-154081f0f74988bdb8979f0447ff5816ab83d8fd.zip
make sure a Content-Length header exists and that the response.body is not nil before trying to call methods on it. Rack does not allow HTTP 204 responses to have a content-length header set. [#5038 state:resolved]
Diffstat (limited to 'activeresource/lib/active_resource')
-rw-r--r--activeresource/lib/active_resource/base.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb
index 7963aa462f..cf3848efb5 100644
--- a/activeresource/lib/active_resource/base.rb
+++ b/activeresource/lib/active_resource/base.rb
@@ -1318,7 +1318,7 @@ module ActiveResource
end
def load_attributes_from_response(response)
- if response['Content-Length'] != "0" && response.body.strip.size > 0
+ if !response['Content-Length'].blank? && response['Content-Length'] != "0" && !response.body.nil? && response.body.strip.size > 0
load(self.class.format.decode(response.body))
end
end