Skip to content

Commit

Permalink
use a slightly more verbose example
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Sep 10, 2015
1 parent 8b5df65 commit 3528588
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/Mojo/UserAgent.pm
Expand Up @@ -515,7 +515,11 @@ L<Mojo::UserAgent::CookieJar> object.
# Ignore cookies for public suffixes
my $ps = IO::Socket::SSL::PublicSuffix->default;
$ua->cookie_jar->ignore(sub { ($ps->public_suffix(shift->domain))[0] eq '' });
$ua->cookie_jar->ignore(sub {
my $cookie = shift;
return unless my $domain = $cookie->domain;
return ($ps->public_suffix($domain))[0] eq '';
});
# Add custom cookie to the jar
$ua->cookie_jar->add(
Expand Down
2 changes: 1 addition & 1 deletion t/mojo/cookie.t
Expand Up @@ -209,7 +209,7 @@ is $cookies->[1], undef, 'no more cookies';
# Parse response cookie with invalid flag (RFC 6265)
$cookies
= Mojo::Cookie::Response->parse(
'foo="ba r"; Domain=example.com; Path=/test; Max-Age=60;'
'foo="ba r"; Domain=.example.com; Path=/test; Max-Age=60;'
. ' Expires=Thu, 07 Aug 2008 07:07:59 GMT; InSecure;');
is $cookies->[0]->name, 'foo', 'right name';
is $cookies->[0]->value, 'ba r', 'right value';
Expand Down

0 comments on commit 3528588

Please sign in to comment.