From 330d7ef7195074b89d30837ffc2461950ca903c6 Mon Sep 17 00:00:00 2001 From: Daniel Azuma Date: Mon, 19 Oct 2020 13:30:38 -0700 Subject: [PATCH] fix: Fix JSON parser crash if an empty body (such as HTTP 204) is received --- lib/google/apis/core/api_command.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/google/apis/core/api_command.rb b/lib/google/apis/core/api_command.rb index 07fefc5a4..f68c497db 100644 --- a/lib/google/apis/core/api_command.rb +++ b/lib/google/apis/core/api_command.rb @@ -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