changeset 1538:c49e5ca1d840

Tests: dav tests with unsupported request body.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 26 Dec 2019 18:55:56 +0300
parents beb549bce15f
children 57a92c20f974
files dav.t
diffstat 1 files changed, 83 insertions(+), 1 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(21);
+my $t = Test::Nginx->new()->has(qw/http dav/)->plan(27);
 
 $t->write_file_expand('nginx.conf', <<'EOF');
 
@@ -182,4 +182,86 @@ like($r, qr/201 Created.*(Content-Length
 like($r, qr!Location: /i/alias\x0d?$!ms, 'location alias');
 is(-s $t->testdir() . '/alias', 10, 'put alias size');
 
+# request methods with unsupported request body
+
+$r = http(<<EOF . '0123456789');
+MKCOL /test/ HTTP/1.1
+Host: localhost
+Connection: close
+Content-Length: 10
+
+EOF
+
+like($r, qr/415 Unsupported/, 'mkcol body');
+
+$r = http(<<EOF . '0123456789');
+COPY /file HTTP/1.1
+Host: localhost
+Destination: /file.exist
+Connection: close
+Content-Length: 10
+
+EOF
+
+like($r, qr/415 Unsupported/, 'copy body');
+
+
+$r = http(<<EOF . '0123456789');
+DELETE /file HTTP/1.1
+Host: localhost
+Connection: close
+Content-Length: 10
+
+EOF
+
+like($r, qr/415 Unsupported/, 'delete body');
+
+TODO: {
+local $TODO = 'not yet' unless $t->has_version('1.17.7');
+
+$r = http(<<EOF);
+MKCOL /test/ HTTP/1.1
+Host: localhost
+Connection: close
+Transfer-Encoding: chunked
+
+a
+0123456789
+0
+
+EOF
+
+like($r, qr/415 Unsupported/, 'mkcol body chunked');
+
+$r = http(<<EOF);
+COPY /file HTTP/1.1
+Host: localhost
+Destination: /file.exist
+Connection: close
+Transfer-Encoding: chunked
+
+a
+0123456789
+0
+
+EOF
+
+like($r, qr/415 Unsupported/, 'copy body chunked');
+
+$r = http(<<EOF);
+DELETE /file HTTP/1.1
+Host: localhost
+Connection: close
+Transfer-Encoding: chunked
+
+a
+0123456789
+0
+
+EOF
+
+like($r, qr/415 Unsupported/, 'delete body chunked');
+
+}
+
 ###############################################################################