changeset 142:d732aaa5f370

Tests: two more return/error_page tests, with builtin error pages.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 02 Nov 2010 08:20:58 +0300
parents 1e1975cd25ef
children e8546edb0267
files rewrite.t
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/rewrite.t
+++ b/rewrite.t
@@ -21,7 +21,7 @@ use Test::Nginx;
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
-my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(17)
+my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(19)
 	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
@@ -59,6 +59,15 @@ http {
             return 200;
         }
 
+        location /return405 {
+            return 405;
+        }
+
+        location /error404return405 {
+            error_page 404 /return405;
+            return 404;
+        }
+
         location /error405return204 {
             error_page 405 /return204;
             return 405;
@@ -69,9 +78,6 @@ http {
             return 405;
         }
 
-        location /file.html {
-        }
-
         location /return200text {
             return 200 "text";
         }
@@ -136,6 +142,9 @@ like(http_get('/no?a=b'), qr!^Location: 
 
 like(http_get('/return204'), qr!204 No Content!, 'return 204');
 like(http_get('/return200'), qr!200 OK!, 'return 200');
+like(http_get('/return405'), qr!HTTP/1.1 405.*body!ms, 'return 405');
+
+like(http_get('/error404return405'), qr!HTTP/1.1 404!, 'error 404 return 405');
 
 TODO: {
 local $TODO = 'not yet';