From 154081f0f74988bdb8979f0447ff5816ab83d8fd Mon Sep 17 00:00:00 2001 From: Mike Abner Date: Wed, 7 Jul 2010 14:23:16 -0700 Subject: 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] --- activeresource/lib/active_resource/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activeresource/lib') 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 -- cgit v1.2.3