From cbde78c6f4893aad53a003e19f818e65b3247723 Mon Sep 17 00:00:00 2001 From: Kalaiselvan Nadar Date: Tue, 30 Jul 2019 15:08:06 -0700 Subject: [PATCH] Fixed an issue in APIClient DoGetList method --- clients/APIClient.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/clients/APIClient.go b/clients/APIClient.go index 903b506..1f19235 100644 --- a/clients/APIClient.go +++ b/clients/APIClient.go @@ -94,13 +94,20 @@ func (apiClient *APIClient) DoGetList(requestString string, rawToken string) ([] if err != nil { return nil, err } - - mapResponse, ok := response.([]map[string]interface{}) + sliceOfGenericObjects, ok := response.([]interface{}) if !ok { return nil, errors.New("Could not parse Json to map") } - - return mapResponse, nil + var sliceOfMapObjects []map[string]interface{} + for _, obj := range sliceOfGenericObjects { + mapObject, ok := obj.(map[string]interface{}) + if ok { + sliceOfMapObjects = append(sliceOfMapObjects, mapObject) + } else { + return nil, errors.New("Could not parse Json to map") + } + } + return sliceOfMapObjects, nil } // DoPost is a generic method to carry out RESTful calls to the other external microservices in ISLA