Mercurial > hg > nginx-tests
comparison h2_variables.t @ 948:4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Stopped exporting any subroutines. A subset of them now act as class methods.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 17 Jun 2016 11:36:33 +0300 |
parents | a6abbfed42c0 |
children | e9064d691790 |
comparison
equal
deleted
inserted
replaced
947:b9e42c554ba7 | 948:4dc302d8e04f |
---|---|
61 | 61 |
62 ############################################################################### | 62 ############################################################################### |
63 | 63 |
64 # $http2 | 64 # $http2 |
65 | 65 |
66 my $sess = new_session(); | 66 my $s = Test::Nginx::HTTP2->new(); |
67 my $sid = new_stream($sess, { path => '/h2' }); | 67 my $sid = $s->new_stream({ path => '/h2' }); |
68 my $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); | 68 my $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
69 | 69 |
70 my ($frame) = grep { $_->{type} eq "DATA" } @$frames; | 70 my ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
71 is($frame->{data}, 'h2c', 'http variable - h2c'); | 71 is($frame->{data}, 'h2c', 'http variable - h2c'); |
72 | 72 |
73 # $server_protocol | 73 # $server_protocol |
74 | 74 |
75 $sess = new_session(); | 75 $s = Test::Nginx::HTTP2->new(); |
76 $sid = new_stream($sess, { path => '/sp' }); | 76 $sid = $s->new_stream({ path => '/sp' }); |
77 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); | 77 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
78 | 78 |
79 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | 79 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
80 is($frame->{data}, 'HTTP/2.0', 'server_protocol variable'); | 80 is($frame->{data}, 'HTTP/2.0', 'server_protocol variable'); |
81 | 81 |
82 # $scheme | 82 # $scheme |
83 | 83 |
84 $sess = new_session(); | 84 $s = Test::Nginx::HTTP2->new(); |
85 $sid = new_stream($sess, { path => '/scheme' }); | 85 $sid = $s->new_stream({ path => '/scheme' }); |
86 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); | 86 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
87 | 87 |
88 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | 88 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
89 is($frame->{data}, 'http', 'scheme variable'); | 89 is($frame->{data}, 'http', 'scheme variable'); |
90 | 90 |
91 # $https | 91 # $https |
92 | 92 |
93 $sess = new_session(); | 93 $s = Test::Nginx::HTTP2->new(); |
94 $sid = new_stream($sess, { path => '/https' }); | 94 $sid = $s->new_stream({ path => '/https' }); |
95 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); | 95 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
96 | 96 |
97 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | 97 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
98 is($frame->{data}, '', 'https variable'); | 98 is($frame->{data}, '', 'https variable'); |
99 | 99 |
100 ############################################################################### | 100 ############################################################################### |