Mercurial > hg > nginx-tests
diff dav.t @ 1150:ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 21 Mar 2017 15:42:21 +0300 |
parents | 882267679006 |
children | 6efe4dbf713b |
line wrap: on
line diff
--- a/dav.t +++ b/dav.t @@ -21,7 +21,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http dav/)->plan(15); +my $t = Test::Nginx->new()->has(qw/http dav/)->plan(18); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -42,6 +42,11 @@ http { location / { dav_methods PUT DELETE MKCOL COPY MOVE; } + + location /i/ { + alias %%TESTDIR%%/; + dav_methods PUT DELETE MKCOL COPY MOVE; + } } } @@ -144,4 +149,16 @@ like($r, qr/204 No Content/, 'copy file is(-s $t->testdir() . '/file-moved escape', 10, 'file copied unescaped'); +$r = http(<<EOF . '0123456789'); +PUT /i/alias HTTP/1.1 +Host: localhost +Connection: close +Content-Length: 10 + +EOF + +like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, 'put alias'); +like($r, qr!Location: http://localhost:\d+/i/alias\x0d?$!ms, 'location alias'); +is(-s $t->testdir() . '/alias', 10, 'put alias size'); + ###############################################################################