Course of Raku / Functional, concurrent, reactive, and web programming / Web programming / A simple HTTP client / Exercises

Status with a client

Problem

Do the same job as the raw-socket request, but with the Cro client module. Use Cro::HTTP::Client.get to fetch http://example.com/, await the response, and print its .status — no text parsing needed.

This exercise needs the Cro module installed (zef install cro) and a working network connection.

Example

When run, the program prints:

200

Solution

See the solution

Course navigation

Solution: A GET request   |   Solution: Status with a client