fix: Fix JSON parser crash if an empty body (such as HTTP 204) is received
This commit is contained in:
parent
0d5fb8c094
commit
330d7ef719
|
@ -83,6 +83,7 @@ module Google
|
||||||
return super if options && options.skip_deserialization
|
return super if options && options.skip_deserialization
|
||||||
return super if content_type.nil?
|
return super if content_type.nil?
|
||||||
return nil unless content_type.start_with?(JSON_CONTENT_TYPE)
|
return nil unless content_type.start_with?(JSON_CONTENT_TYPE)
|
||||||
|
body = "{}" if body.empty?
|
||||||
instance = response_class.new
|
instance = response_class.new
|
||||||
response_representation.new(instance).from_json(body, unwrap: response_class)
|
response_representation.new(instance).from_json(body, unwrap: response_class)
|
||||||
instance
|
instance
|
||||||
|
|
Loading…
Reference in New Issue