1
# vim:set ft= ts=4 sw=4 et fdm=marker:
4
use Test::Nginx::Socket;
6
#worker_connections(1014);
7
#master_process_enabled(1);
13
plan tests => blocks() * repeat_each() * 3;
18
$ENV{TEST_NGINX_PORT} ||= 1984;
24
=== TEST 1: default 302
28
ngx.redirect("http://www.taobao.com/foo");
35
Location: http://www.taobao.com/foo
36
--- response_body_like: 302 Found
41
=== TEST 2: explicit 302
45
ngx.redirect("http://www.taobao.com/foo", ngx.HTTP_MOVED_TEMPORARILY);
52
Location: http://www.taobao.com/foo
53
--- response_body_like: 302 Found
58
=== TEST 3: explicit 301
62
ngx.redirect("http://www.taobao.com/foo", ngx.HTTP_MOVED_PERMANENTLY);
69
Location: http://www.taobao.com/foo
70
--- response_body_like: 301 Moved Permanently
79
ngx.redirect("http://www.taobao.com/foo", 404);
87
--- response_body_like: 500 Internal Server Error
104
--- response_body_like: 500 Internal Server Error
109
=== TEST 6: relative uri
119
--- raw_response_headers_like: Location: http://localhost(?::\d+)?/foo\r\n
120
--- response_body_like: 302 Found