Skip to content

Commit

Permalink
Added tests for Cookie behavior.
Browse files Browse the repository at this point in the history
  • Loading branch information
peelle committed Aug 2, 2024
1 parent fc1fc10 commit c1d6c52
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions t/http-request.t
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ use Test;
dies-ok { $req.add-cookie('', '') }, 'Empty names are not permitted';
$req.add-cookie('Heaven', 'Valhalla');
like $req.Str, /"GET / HTTP/1.0\r\nCookie: " ['Foo=Bar' || 'Heaven=Valhalla' || 'Lang=US'] ** 3 % '; ' "\r\n\r\n"/, 'Cookie header looks good';

# Default behavior for HTTP 1.1
$req.remove-cookie('lang');
$req.append-header(Cro::HTTP::Header.new(name => 'cookie', value => 'lang=us'));
is $req.has-cookie('lang'), False, 'lang cookie header should not be parsed for HTTP 1.1';

$req.http-version = '2.0';
is $req.has-cookie('lang'), True, 'lang cookie header should be parsed for HTTP 2';
}

{
Expand Down

0 comments on commit c1d6c52

Please sign in to comment.