Skip to content

Commit

Permalink
make sure a Content-Length header exists and that the response.body i…
Browse files Browse the repository at this point in the history
…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
MikeAbner authored and josevalim committed Sep 18, 2010
1 parent 39debfc commit 154081f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activeresource/lib/active_resource/base.rb
Expand Up @@ -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
Expand Down

0 comments on commit 154081f

Please sign in to comment.