Skip to content
Browse files

make sure a Content-Length header exists and that the response.body i…

…s 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]
  • Loading branch information...
1 parent 39debfc commit 154081f0f74988bdb8979f0447ff5816ab83d8fd @malyk malyk committed with josevalim Jul 7, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 activeresource/lib/active_resource/base.rb
View
2 activeresource/lib/active_resource/base.rb
@@ -1318,7 +1318,7 @@ def create
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

0 comments on commit 154081f

Please sign in to comment.
Something went wrong with that request. Please try again.