Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion http_headers_multi.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use Test::Nginx;
select STDERR; $| = 1;
select STDOUT; $| = 1;

my $t = Test::Nginx->new()->has(qw/http rewrite proxy/)->plan(42);
my $t = Test::Nginx->new()->has(qw/http rewrite proxy/)->plan(47);

$t->write_file_expand('nginx.conf', <<'EOF');

Expand All @@ -49,6 +49,7 @@ http {
add_header X-Cookie-Foo $cookie_foo;
add_header X-Cookie-Bar $cookie_bar;
add_header X-Cookie-Bazz $cookie_bazz;
add_header X-Cookie-Qux $cookie_qux;

return 204;
}
Expand Down Expand Up @@ -155,6 +156,18 @@ like($r, qr/X-Cookie-Foo: 1/, '$cookie_foo');
like($r, qr/X-Cookie-Bar: 2/, '$cookie_bar');
like($r, qr/X-Cookie-Bazz: 3/, '$cookie_bazz');

# request cookies, multiple values

like(get('/', 'Cookie: foo=1, qux=0; bar=2', 'Cookie: bazz=3'),
qr/X-Cookie: foo=1, qux=0; bar=2; bazz=3/, 'multi comma $http_cookie');

$r = get('/', 'Cookie: foo=1, qux=0; bar=2', 'Cookie: bazz=3');

like($r, qr/X-Cookie-Foo: 1, qux=0/, '$cookie_foo');
like($r, qr/X-Cookie-Bar: 2/, '$cookie_bar');
like($r, qr/X-Cookie-Bazz: 3/, '$cookie_bazz');
unlike($r, qr/X-Cookie-Qux:/, '$cookie_qux');

# response headers, $http_*

$r = get('/s');
Expand Down