Quellcode durchsuchen

fix:when map is null, it's value is rather than null

wenzuochao vor 6 Jahren
Ursprung
Commit
54a7a84eb1
2 geänderte Dateien mit 4 neuen und 0 gelöschten Zeilen
  1. 3 0
      sdk/requests/acs_request.go
  2. 1 0
      sdk/requests/acs_request_test.go

+ 3 - 0
sdk/requests/acs_request.go

@@ -322,6 +322,9 @@ func flatRepeatedList(dataValue reflect.Value, request AcsRequest, position, pre
 				if dataValue.Field(i).Kind().String() == "map" {
 					byt, _ := json.Marshal(dataValue.Field(i).Interface())
 					value = string(byt)
+					if value == "null" {
+						value = ""
+					}
 				}
 				err = addParam(request, fieldPosition, key, value)
 				if err != nil {

+ 1 - 0
sdk/requests/acs_request_test.go

@@ -197,6 +197,7 @@ type CreateContainerGroupRequest struct {
 	Cpu                     Float                                           `position:"Query" name:"Cpu"`
 	Memory                  Float                                           `position:"Query" name:"Memory"`
 	DnsConfig               CreateContainerGroup_DnsConfig                  `position:"Query" name:"DnsConfig" type:"Struct"`
+	OptionJson              map[string]interface{}                          `position:"Query" name:"OptionJson"`
 }
 
 type CreateContainerGroup_Tag struct {