#http client request with empty resource path

1 messages · Page 1 of 1 (latest)

radiant holly
#

When we invoke a http client in remote client style. we are able to pass an empty string as the path parameter. How do we achieve the same requirement when we use resource function style?

Note that we can't seperate out the base path and resource path as we are getting the url from outside as a parameter.

public function main() returns error? {
    // Creates a HTTP client to download the audio file
    string podcastURL = "https://www.book2.nl/book2/DE/SOUND/0703.mp3";
    http:Client podcastEP = check new (podcastURL);
    //works
    http:Response httpResp = check podcastEP->get("");
    //does not work
    http:Response httpResp = check podcastEP->/get();
}
brisk ore
#

Hi @radiant holly
This is not supported in the resource function style since the syntax requires a slash to starts with
Currently you can achieve this only by using the remote function style

thick current
#

Hey @quasi musk @zinc harbor isn't this a legit requirement?