cro-http-client-cookiejar

Cro::HTTP::Client::CookieJar

A cookie jar is used to hold cookies set by HTTP responses, and add the appropriate cookies to a HTTP request. It is designed for use in conjunction with Cro::HTTP::Client; in many cases, this type need not be used directly.

Adding cookies from a response into the jar

The add-from-response method is used to add the cookies from a Cro::HTTP::Response into the cookie jar. In order to allow correct future matching of the cookies, the request URI must also be included, in order to determine the host, path, and if the request was secure (HTTPS). The URI should be passed as an instance of Cro::Uri.

$jar.add-from-response($resp, $uri);

Adding cookies from the jar into a request

The add-to-request method is used to add cookies from the jar that match the specified request URI into the provided request object. The request should be an instance of Cro::HTTP::Request and the URI an instance of Cro::Uri.

$jar.add-to-request($req, $uri);

Adding cookies directly to the jar

Call the add-cookie method to add a cookie directly to the jar. It requires a Cro::HTTP::Cookie object to be passed.

Introspecting the jar contents

To get a List of all cookies in the jar, use contents. This returns a List of Cro::HTTP::Cookie objects.

my @cookies = $jar.contents;

To get a List containing only those cookies that would match a particular URI, pass that URI to the contents method.

my @uri-cookies = $jar.contents($uri);

Removing cookies from the jar

To remove all cookies from the jar, call clear.

$jar.clear();

To remove all cookies matching a particular URI, pass that URI (it must be a Cro::Uri):

$jar.clear($uri);

To remove an individual cookie, pass the name of the cookie to clear also.

$jar.clear($uri, $name);

cro v0.8.8

Libraries and tools for building reactive services in Raku. This installs the cro command line and web tool, along with HTTP (including HTTPS and HTTP/2.0) and WebSocket support.

Authors

  • Jonathan Worthington

License

Artistic-2.0

Dependencies

IO::Socket::Async::SSLJSON::FastMETA6Shell::CommandFile::FindTerminal::ANSIColorOO::MonitorsYAMLishCro::WebSocket:ver<0.8.8>Docker::FileFile::Ignore

Test Dependencies

Provides

  • Cro::Tools::CLI
  • Cro::Tools::CroFile
  • Cro::Tools::Link::Editor
  • Cro::Tools::LinkTemplate
  • Cro::Tools::LinkTemplate::HTTP
  • Cro::Tools::LinkTemplate::HTTPS
  • Cro::Tools::LinkTemplate::WS
  • Cro::Tools::LinkTemplate::WSS
  • Cro::Tools::Runner
  • Cro::Tools::Serve
  • Cro::Tools::Services
  • Cro::Tools::Template
  • Cro::Tools::Template::Common
  • Cro::Tools::Template::HTTPService
  • Cro::Tools::Template::ReactReduxSPA
  • Cro::Tools::Template::ZeroMQWorkSinkService
  • Cro::Tools::Template::ZeroMQWorkerService
  • Cro::Tools::TemplateLocator
  • Cro::Tools::Web

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.