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]

This commit is contained in:
Mike Abner 2010-07-07 14:23:16 -07:00 committed by José Valim
parent 39debfc854
commit 154081f0f7

@ -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