changeset 1536:0ce1c9516764

Tests: dav.t MKCOL test for trailing slash in Location (if any).
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 23 Dec 2019 19:38:49 +0300
parents 144c6ce732e4
children beb549bce15f
files dav.t
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
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(20);
+my $t = Test::Nginx->new()->has(qw/http dav/)->plan(21);
 
 $t->write_file_expand('nginx.conf', <<'EOF');
 
@@ -39,6 +39,8 @@ http {
         listen       127.0.0.1:8080;
         server_name  localhost;
 
+        absolute_redirect off;
+
         location / {
             dav_methods PUT DELETE MKCOL COPY MOVE;
         }
@@ -117,6 +119,13 @@ EOF
 
 like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, 'mkcol');
 
+TODO: {
+local $TODO = 'not yet' unless $t->has_version('1.17.7');
+
+like($r, qr!(?(?{ $r =~ /Location/ })Location: /test/)!, 'mkcol location');
+
+}
+
 $r = http(<<EOF);
 COPY /test/ HTTP/1.1
 Host: localhost
@@ -170,7 +179,7 @@ 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');
+like($r, qr!Location: /i/alias\x0d?$!ms, 'location alias');
 is(-s $t->testdir() . '/alias', 10, 'put alias size');
 
 ###############################################################################