[Go] [Client] Don't Explode Query Params (#14447)

* If the collection type is csv, that means 'dont explode the query params'.

* Simplify the logic just a tad

* url.Values -> Has was added in go1.17 but there are CI tests running at 1.16
This commit is contained in:
Ian Cubbon
2023-01-13 09:48:27 -07:00
committed by GitHub
parent d348754399
commit 92775ceffc
4 changed files with 20 additions and 4 deletions

View File

@@ -234,7 +234,11 @@ func parameterAddToQuery(queryParams interface{}, keyPrefix string, obj interfac
switch valuesMap := queryParams.(type) {
case url.Values:
valuesMap.Add( keyPrefix, value )
if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" {
valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix) + "," + value)
} else {
valuesMap.Add(keyPrefix, value)
}
break
case map[string]string:
valuesMap[keyPrefix] = value