From 5e331e306658f44e6c04f1b5e913f75ba94d292a Mon Sep 17 00:00:00 2001 From: Luc Talatinian Date: Tue, 21 May 2024 13:47:20 -0400 Subject: [PATCH] don't serialize empty lists in ec2query --- CHANGELOG_PENDING.md | 2 ++ private/protocol/query/queryutil/queryutil.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 8a1927a39ca..8b31be9ec73 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -3,3 +3,5 @@ ### SDK Enhancements ### SDK Bugs +* `service/ec2`: Correct empty list serialization behavior. + * Empty, non-nil lists should NOT be serialized for this service. diff --git a/private/protocol/query/queryutil/queryutil.go b/private/protocol/query/queryutil/queryutil.go index 058334053c2..2ca0b19db7f 100644 --- a/private/protocol/query/queryutil/queryutil.go +++ b/private/protocol/query/queryutil/queryutil.go @@ -122,8 +122,8 @@ func (q *queryParser) parseStruct(v url.Values, value reflect.Value, prefix stri } func (q *queryParser) parseList(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag) error { - // If it's empty, generate an empty value - if !value.IsNil() && value.Len() == 0 { + // If it's empty, and not ec2, generate an empty value + if !value.IsNil() && value.Len() == 0 && !q.isEC2 { v.Set(prefix, "") return nil }