Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
HTTP::Client -- Perl 6 library for building HTTP Clients

NOTE 1: This library is way overdue for a rewrite. See the '2.0' branch for
        what I was working on the last time I looked at this (it's been a few

NOTE 2: As I don't think I'll be able to work on it for quite some time,
        and there are certain pieces of functionality which are completely
        broken in the current version of this library, such as chunked encoding,
        and anything involving binary file transfers,
        please consider using HTTP::UserAgent or Net::HTTP instead.


Inspired by LWP and HTTP::Client from Perl 5, and LWP::Simple
from Perl 6, this is a simple class for building HTTP clients
using Perl 6.

It's not based on any of those when it comes to API, but instead
offers a flexible syntax that's easy to use, and easy to extend.

It currently only supports HTTP itself. HTTP+SSL (HTTPS) support
is planned for a future version.

= Usage =

A simple GET request, without an intermetiary Request object:

  my $client =;
  my $response = $client.get('');
  if ($response.success) {
    say $response.content;

A more advanced POST application/x-www-form-urlencoded request:

  my $client =;
  my $request = $; ## Note we are not setting the URI/URL.
  ## The following line creates Request variables called query and mode.
  ## You could also do $request.set-content('query=libwww-perl&mode=dist');
  ## But I think letting the library build your content for you, is nicer.
  $request.add-field(:query<libwww-perl>, :mode<dist>);
  my $response = $; ## or $$request);

A more advanced POST multipart/form-data request:

  my $client =;
  my $request = $;
    :name("upload"),     :filename("file.txt"),
    :type("text/plain"), :content("hello world...")
  my $response = $;

= Notes =

As seen above, there is no need to build HTTP::Client::Request objects
manually. Just use the appropriate method (get, post, head, put, delete)
or use $client.make-request($method); for methods that don't have methods

As it's name states, this library is specifically for HTTP Clients.
If you want something for building HTTP Servers, see HTTP::Easy.
If you want something for Request/Reponse objects for your Web Application,
see WWW::App. Full disclosure: I wrote both of those libraries too.

Also, there are some weird issues with the IO::Socket::INET library in
the current Rakudo master, which are affecting connecting to outside servers.
So the tests in the t/ folder currently depend on the HTTP::Easy library,
and in particular, the examples/test.p6 script from HTTP::Easy to be running
before you run the tests.

= Requirements =

* Rakudo Perl 6      <>
* HTTP::Status       <>
* MIME::Base64       <>

It should also require:

* URI                <>

But at the current time, that module is not compiling under "master" which
the rest of this is focused on, so for the time being, I'm using a very
limited inline URI grammar instead.

= Author =

Timothy Totten

= License =

Artistic License 2.0


Build HTTP Clients easily with Perl 6






No releases published


No packages published