Skip to content

Instantly share code, notes, and snippets.

@jonathanstowe
Created September 5, 2021 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathanstowe/7af59860823d65e83fd86c934b3e7412 to your computer and use it in GitHub Desktop.
Save jonathanstowe/7af59860823d65e83fd86c934b3e7412 to your computer and use it in GitHub Desktop.
use Cro::HTTP::Client;
my $c;
react {
whenever Cro::HTTP::Client.get("http://cannibal.local") -> $v {
whenever $v.body-text -> $m {
$c = $m;
done;
}
}
}
say $c;
# vim: ft=raku
use Cro::HTTP::Client;
my $c = await (supply {
whenever Cro::HTTP::Client.get("http://cannibal.local") -> $v {
whenever $v.body-text -> $m {
emit $m;
done;
}
}
}).Promise;
say $c;
# vim: ft=raku
use Cro::HTTP::Client;
my $c = await Cro::HTTP::Client.get("http://cannibal.local").then( { $_.result.body-text }).then({ $_.result.result });
say $c;
# vim: ft=raku
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment