Skip to content

Commit

Permalink
Change handling of "null" responses
Browse files Browse the repository at this point in the history
"null" json responses are now handled and return an empty object.
  • Loading branch information
iaddict committed Sep 28, 2018
1 parent 62f174e commit 1870643
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/flexirest/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -721,14 +721,11 @@ def generate_new_object(options={})
elsif is_json_response?
begin
body = @response.body.blank? ? {} : MultiJson.load(@response.body)
body = {} if body.nil?
rescue MultiJson::ParseError
raise ResponseParseException.new(status:@response.status, body:@response.body, headers:@response.headers)
end

if body.nil?
return nil
end

if is_json_api_response?
body = JsonAPIProxy::Response.parse(body, @object)
end
Expand Down

0 comments on commit 1870643

Please sign in to comment.