Skip to content

Commit

Permalink
Fixed an issue in APIClient DoGetList method
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalaiselvan Nadar authored and Kalaiselvan Nadar committed Jul 30, 2019
1 parent 562a120 commit cbde78c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions clients/APIClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cbde78c

Please sign in to comment.