@@ -21,7 +21,7 @@ use Test::Nginx;
21
21
select STDERR ; $| = 1;
22
22
select STDOUT ; $| = 1;
23
23
24
- my $t = Test::Nginx-> new()-> has(qw/ http dav/ )-> plan(21 );
24
+ my $t = Test::Nginx-> new()-> has(qw/ http dav/ )-> plan(27 );
25
25
26
26
$t -> write_file_expand(' nginx.conf' , <<'EOF' );
27
27
@@ -182,4 +182,86 @@ like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, 'put alias');
182
182
like($r , qr ! Location: /i/alias\x0d ?$ ! ms , ' location alias' );
183
183
is(-s $t -> testdir() . ' /alias' , 10, ' put alias size' );
184
184
185
+ # request methods with unsupported request body
186
+
187
+ $r = http(<<EOF . ' 0123456789' );
188
+ MKCOL /test/ HTTP/1.1
189
+ Host: localhost
190
+ Connection: close
191
+ Content-Length: 10
192
+
193
+ EOF
194
+
195
+ like($r , qr / 415 Unsupported/ , ' mkcol body' );
196
+
197
+ $r = http(<<EOF . ' 0123456789' );
198
+ COPY /file HTTP/1.1
199
+ Host: localhost
200
+ Destination: /file.exist
201
+ Connection: close
202
+ Content-Length: 10
203
+
204
+ EOF
205
+
206
+ like($r , qr / 415 Unsupported/ , ' copy body' );
207
+
208
+
209
+ $r = http(<<EOF . ' 0123456789' );
210
+ DELETE /file HTTP/1.1
211
+ Host: localhost
212
+ Connection: close
213
+ Content-Length: 10
214
+
215
+ EOF
216
+
217
+ like($r , qr / 415 Unsupported/ , ' delete body' );
218
+
219
+ TODO: {
220
+ local $TODO = ' not yet' unless $t -> has_version(' 1.17.7' );
221
+
222
+ $r = http(<<EOF );
223
+ MKCOL /test/ HTTP/1.1
224
+ Host: localhost
225
+ Connection: close
226
+ Transfer-Encoding: chunked
227
+
228
+ a
229
+ 0123456789
230
+ 0
231
+
232
+ EOF
233
+
234
+ like($r , qr / 415 Unsupported/ , ' mkcol body chunked' );
235
+
236
+ $r = http(<<EOF );
237
+ COPY /file HTTP/1.1
238
+ Host: localhost
239
+ Destination: /file.exist
240
+ Connection: close
241
+ Transfer-Encoding: chunked
242
+
243
+ a
244
+ 0123456789
245
+ 0
246
+
247
+ EOF
248
+
249
+ like($r , qr / 415 Unsupported/ , ' copy body chunked' );
250
+
251
+ $r = http(<<EOF );
252
+ DELETE /file HTTP/1.1
253
+ Host: localhost
254
+ Connection: close
255
+ Transfer-Encoding: chunked
256
+
257
+ a
258
+ 0123456789
259
+ 0
260
+
261
+ EOF
262
+
263
+ like($r , qr / 415 Unsupported/ , ' delete body chunked' );
264
+
265
+ }
266
+
185
267
# ##############################################################################
0 commit comments