fix: Fix JSON parser crash if an empty body (such as HTTP 204) is received

This commit is contained in:
Daniel Azuma authored and GitHub committed 2020-10-19 13:30:38 -07:00
1 parent 0d5fb8c094
commit 330d7ef719
1 file changed
+1
+1
View File
@@ -83,6 +83,7 @@ module Google
return super if options && options.skip_deserialization
return super if content_type.nil?
return nil unless content_type.start_with?(JSON_CONTENT_TYPE)
body = "{}" if body.empty?
instance = response_class.new
response_representation.new(instance).from_json(body, unwrap: response_class)
instance