Skip to content

Commit

Permalink
Fix test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
TharmiganK committed Sep 24, 2024
1 parent 3cd34e9 commit f76cf94
Showing 1 changed file with 5 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public isolated client class Client {
string resourcePath = string `/albums`;
map<Encoding> queryParamEncoding = {"_artists_": {style: FORM, explode: true}};
resourcePath = resourcePath + check getPathForQueryParam(queries, queryParamEncoding);
map<string|string[]> httpHeaders = getMapForHeaders(headers);
map<string|string[]> httpHeaders = http:getHeaderMap(headers);
return self.clientEp->get(resourcePath, httpHeaders);
}

Expand Down Expand Up @@ -243,12 +243,13 @@ isolated function getEncodedUri(anydata value) returns string {
# + encodingMap - Details on serialization mechanism
# + return - Returns generated Path or error at failure of client initialization
isolated function getPathForQueryParam(map<anydata> queryParam, map<Encoding> encodingMap = {}) returns string|error {
map<anydata> queriesMap = http:getQueryMap(queryParam);
string[] param = [];
if queryParam.length() > 0 {
if queriesMap.length() > 0 {
param.push("?");
foreach var [key, value] in queryParam.entries() {
foreach var [key, value] in queriesMap.entries() {
if value is () {
_ = queryParam.remove(key);
_ = queriesMap.remove(key);
continue;
}
Encoding encodingData = encodingMap.hasKey(key) ? encodingMap.get(key) : defaultEncoding;
Expand All @@ -273,23 +274,6 @@ isolated function getPathForQueryParam(map<anydata> queryParam, map<Encoding> en
return restOfPath;
}

# Generate header map for given header values.
#
# + headerParam - Headers map
# + return - Returns generated map or error at failure of client initialization
isolated function getMapForHeaders(map<anydata> headerParam) returns map<string|string[]> {
map<string|string[]> headerMap = {};
foreach var [key, value] in headerParam.entries() {
if value is SimpleBasicType[] {
headerMap[key] = from SimpleBasicType data in value
select data.toString();
} else {
headerMap[key] = value.toString();
}
}
return headerMap;
}

public type AlbumARTIST record {|
Album[] albums;
string name;
Expand Down

0 comments on commit f76cf94

Please sign in to comment.