ballerina-platform/ballerina-library

HTTP client can not data-bind CSV response into a Ballerina record

Opened this issue · 1 comments

Description:

$subject

Consider following code:

type XeResponse record {
    float amount;
};

http:Client xeClient = check new("https://xecdapi.xe.com/v1", auth = ...);
XeResponse xeResponse = check self.xeClient->/convert_from\.csv\/(
    'from = fromCurrency,
    to = toCurrency,
    amount = amount
);

XE Currency convertor API [1] used in the above code returns a CSV response in following format;

Terms,https://www.xe.com/legal/,Privacy,http://www.xe.com/privacy.php
from,amount,timestamp,quotecurrency,mid
USD,10.0,2024-06-07T00:00:00Z,GBP,12.345

[1] - https://xecdapi.xe.com/docs/v1#/Mid-market%20Rates/get_v1_convert_from

But the Ballerina code throws a data-binding error.

ATM we dont support data binding for csv type right?