-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
From the documentation
my $client = Cro::HTTP::Client.new(base-uri => "http://foo.com/some/path/");
await $client.get('added'); # http://foo.com/some/path/added
I was expecting the following two sets of code to be the same.
So while this works:
use Cro::HTTP::Client;
my $resp = await Cro::HTTP::Client.get("https://api.github.com/repos/Raku/doc/contents/doc/Language/REPL.rakudoc");
my $json = await $resp.body;
say "json keys are ", $json.keys;
with response
json keys are (content encoding url path type _links sha name html_url download_url size git_url)
This does not
use Cro::HTTP::Client;
my $client = Cro::HTTP::Client.new;
my $resp = await $client.get("https://api.github.com/repos/Raku/doc/contents/doc/Language/REPL.rakudoc");
#my $resp = await Cro::HTTP::Client.get("https://api.github.com/repos/Raku/doc/contents/doc/Language/REPL.rakudoc");
my $json = await $resp.body;
say "json keys are ", $json.keys;
with error message
Cannot keep/break a Promise more than once (status: Broken)
Since the simplest case of an instantiation does not work, I can't use :base-uri, which I would like.
However, in the tests for Cro::HTTP::Client, there is an instantiated object of the class, using :base-uri.
So, what am I doing wrong?
Metadata
Metadata
Assignees
Labels
No labels