Mercurial > hg > nginx-tests
comparison http_variables.t @ 999:ff12dfdb0cda
Tests: added test for the $limit_rate variable.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 29 Jul 2016 13:01:08 +0300 |
parents | 882267679006 |
children | 577a5899a33d |
comparison
equal
deleted
inserted
replaced
998:79ba0a5be312 | 999:ff12dfdb0cda |
---|---|
57 | 57 |
58 location /redefine { | 58 location /redefine { |
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 | |
63 location /limit_rate { | |
64 set $limit_rate 40k; | |
65 add_header X-Rate $limit_rate; | |
66 return 200 OK; | |
67 } | |
62 } | 68 } |
63 } | 69 } |
64 | 70 |
65 EOF | 71 EOF |
66 | 72 |
70 | 76 |
71 http_get('/'); | 77 http_get('/'); |
72 http_get('/../bad_uri'); | 78 http_get('/../bad_uri'); |
73 http_get('/redefine'); | 79 http_get('/redefine'); |
74 | 80 |
81 # $limit_rate is a special variable that has its own set_handler / get_handler | |
82 | |
83 like(http_get('/limit_rate'), qr/X-Rate: 40960/, 'limit_rate handlers'); | |
84 | |
75 $t->stop(); | 85 $t->stop(); |
76 | 86 |
77 my $log = $t->read_file('cc.log'); | 87 my $log = $t->read_file('cc.log'); |
78 like($log, qr!^: -$!m, 'no uri'); | 88 like($log, qr!^: -$!m, 'no uri'); |
79 like($log, qr!^/: -$!m, 'no header'); | 89 like($log, qr!^/: -$!m, 'no header'); |