From f76cf94b816eec785615a9f2d86d0b2f87390101 Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Tue, 24 Sep 2024 15:52:59 +0530 Subject: [PATCH] Fix test failures --- .../expected_gen/bal_name_ext_client.bal | 26 ++++--------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/openapi-cli/src/test/resources/expected_gen/bal_name_ext_client.bal b/openapi-cli/src/test/resources/expected_gen/bal_name_ext_client.bal index 055968c1e..c33efdb84 100644 --- a/openapi-cli/src/test/resources/expected_gen/bal_name_ext_client.bal +++ b/openapi-cli/src/test/resources/expected_gen/bal_name_ext_client.bal @@ -47,7 +47,7 @@ public isolated client class Client { string resourcePath = string `/albums`; map queryParamEncoding = {"_artists_": {style: FORM, explode: true}}; resourcePath = resourcePath + check getPathForQueryParam(queries, queryParamEncoding); - map httpHeaders = getMapForHeaders(headers); + map httpHeaders = http:getHeaderMap(headers); return self.clientEp->get(resourcePath, httpHeaders); } @@ -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 queryParam, map encodingMap = {}) returns string|error { + map 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; @@ -273,23 +274,6 @@ isolated function getPathForQueryParam(map queryParam, map 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 headerParam) returns map { - map 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;