Skip to content

Commit

Permalink
more cookie testing for escapes etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
miyagawa committed Jan 28, 2010
1 parent aeb1802 commit c306d47
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions t/Plack-Request/cookie.t
@@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 5;
use Test::More;
use HTTP::Request;
use Test::Requires qw(CGI::Simple::Cookie);
use Plack::Test;
Expand All @@ -12,15 +12,16 @@ my $app = sub {
is $req->cookies->{undef}, undef;
is $req->cookies->{Foo}, 'Bar';
is $req->cookies->{Bar}, 'Baz';
is_deeply $req->cookies, {Foo => 'Bar', Bar => 'Baz'};
is $req->cookies->{XXX}, 'Foo Bar';
is $req->cookies->{YYY}, 0;

$req->new_response(200)->finalize;
};

test_psgi $app, sub {
my $cb = shift;
my $req = HTTP::Request->new(GET => "/");
$req->header(Cookie => 'Foo=Bar; Bar=Baz');
$req->header(Cookie => 'Foo=Bar; Bar=Baz; XXX=Foo%20Bar; YYY=0; YYY=3');
$cb->($req);
};

Expand All @@ -35,3 +36,4 @@ test_psgi $app, sub {
$cb->(HTTP::Request->new(GET => "/"));
};

done_testing;

0 comments on commit c306d47

Please sign in to comment.