How do you make HTTP requests with Raku?

I want to contribute a little more. There is a fantastic module named WWW. It's very convenient to make 'gets' that receive json because it can be parsed automagically.

In their example:

use WWW;
my $response = jget('');

You can examine the objects using the basic functionalities of arrays and hashes, for example to extract the values of my response you can use:


Here the number [1] are a nested list inside a hash, and the properties are the same. Welcome to the raku community !!!

You may want to try out the recent HTTP::Tiny module.

use HTTP::Tiny;
my $response = '' );
say $response<content>.decode

After searching around a bit, I found an answer in the Cro docs.

use Cro::HTTP::Client;

my $resp = await Cro::HTTP::Client.get('');
my $body = await $resp.body;

# `$body` is a hash
say $body;

There's more information on headers and POST requests in the link.