comparison http_variables.t @ 1464:4bc1490cedbc

Tests: added $limit_rate test with invalid empty value.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 16 Apr 2019 17:12:06 +0300
parents cb46ac65d50e
children cd6abbe0f989
comparison
equal deleted inserted replaced
1463:5ac92857e419 1464:4bc1490cedbc
20 ############################################################################### 20 ###############################################################################
21 21
22 select STDERR; $| = 1; 22 select STDERR; $| = 1;
23 select STDOUT; $| = 1; 23 select STDOUT; $| = 1;
24 24
25 my $t = Test::Nginx->new()->has(qw/http rewrite proxy/)->plan(5); 25 my $t = Test::Nginx->new()->has(qw/http rewrite proxy/)->plan(6);
26 26
27 $t->write_file_expand('nginx.conf', <<'EOF'); 27 $t->write_file_expand('nginx.conf', <<'EOF');
28 28
29 %%TEST_GLOBALS%% 29 %%TEST_GLOBALS%%
30 30
59 expires epoch; 59 expires epoch;
60 proxy_pass http://127.0.0.1:8080/set; 60 proxy_pass http://127.0.0.1:8080/set;
61 } 61 }
62 62
63 location /limit_rate { 63 location /limit_rate {
64 set $limit_rate 40k; 64 set $limit_rate $arg_l;
65 add_header X-Rate $limit_rate; 65 add_header X-Rate $limit_rate;
66 return 200 OK; 66 return 200 OK;
67 } 67 }
68 } 68 }
69 } 69 }
78 http_get('/../bad_uri'); 78 http_get('/../bad_uri');
79 http_get('/redefine'); 79 http_get('/redefine');
80 80
81 # $limit_rate is a special variable that has its own set_handler / get_handler 81 # $limit_rate is a special variable that has its own set_handler / get_handler
82 82
83 like(http_get('/limit_rate'), qr/X-Rate: 40960/, 'limit_rate handlers'); 83 like(http_get('/limit_rate?l=40k'), qr/X-Rate: 40960/, 'limit_rate handlers');
84 like(http_get('/limit_rate'), qr/X-Rate: 0/, 'limit_rate invalid');
84 85
85 $t->stop(); 86 $t->stop();
86 87
87 my $log = $t->read_file('cc.log'); 88 my $log = $t->read_file('cc.log');
88 like($log, qr!^: -$!m, 'no uri'); 89 like($log, qr!^: -$!m, 'no uri');