Mercurial > hg > nginx-tests
comparison js_internal_redirect.t @ 1345:9fbe84b7ddc6
Tests: style.
author | Dmitry Volyntsev <xeioex@nginx.com> |
---|---|
date | Wed, 13 Jun 2018 15:48:56 +0300 |
parents | 2ff483941037 |
children | 4d5d1e59f45e |
comparison
equal
deleted
inserted
replaced
1344:856ab7671404 | 1345:9fbe84b7ddc6 |
---|---|
46 location /test { | 46 location /test { |
47 js_content test_redirect; | 47 js_content test_redirect; |
48 } | 48 } |
49 | 49 |
50 location /redirect { | 50 location /redirect { |
51 internal; | 51 internal; |
52 return 200 redirect$arg_b; | 52 return 200 redirect$arg_b; |
53 } | 53 } |
54 | 54 |
55 location @named { | 55 location @named { |
56 return 200 named; | 56 return 200 named; |
59 } | 59 } |
60 | 60 |
61 EOF | 61 EOF |
62 | 62 |
63 $t->write_file('test.js', <<EOF); | 63 $t->write_file('test.js', <<EOF); |
64 function test_redirect(req, res) { | 64 function test_redirect(req) { |
65 if (req.variables.arg_dest.startsWith('named')) { | 65 if (req.variables.arg_dest.startsWith('named')) { |
66 req.internalRedirect('\@named'); | 66 req.internalRedirect('\@named'); |
67 | 67 |
68 } else { | 68 } else { |
69 if (req.variables.arg_a) { | 69 if (req.variables.arg_a) { |
70 req.internalRedirect('/redirect?b=' + req.variables.arg_a); | 70 req.internalRedirect('/redirect?b=' + req.variables.arg_a); |
71 | 71 |
72 } else { | 72 } else { |
73 req.internalRedirect('/redirect'); | 73 req.internalRedirect('/redirect'); |
74 } | 74 } |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 EOF | 78 EOF |
79 | 79 |
80 $t->try_run('no njs internalRedirect')->plan(3); | 80 $t->try_run('no njs internalRedirect')->plan(3); |