1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
# vi:filetype=perl
use lib 'lib';
use Test::Nginx::Socket;
#repeat_each(3);
plan tests => repeat_each() * 2 * blocks();
no_long_string();
run_tests();
#no_diff();
__DATA__
=== TEST 1: hex encode
--- config
location /bar {
set_encode_hex $out "abcde";
echo $out;
}
--- request
GET /bar
--- response_body
6162636465
=== TEST 2: hex decode
--- config
location /bar {
set_decode_hex $out "6162636465";
echo $out;
}
--- request
GET /bar
--- response_body
abcde
=== TEST 3: hex encode (chinese)
--- config
location /bar {
set $raw "章亦春";
set_encode_hex $digest $raw;
set_decode_hex $hex $digest;
echo $digest;
echo $hex;
}
--- request
GET /bar
--- response_body
e7aba0e4baa6e698a5
章亦春
|