mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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:
parent
39debfc854
commit
154081f0f7
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue