Mercurial > hg > nginx-tests
comparison js_internal_redirect.t @ 1760:3580ad4b575f
Tests: fixed js_internal_redirect.t TODO.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 26 May 2022 14:49:10 +0400 |
parents | ce8b0c9452ae |
children | 520fb74cce4c |
comparison
equal
deleted
inserted
replaced
1759:8f13779e2cde | 1760:3580ad4b575f |
---|---|
39 | 39 |
40 server { | 40 server { |
41 listen 127.0.0.1:8080; | 41 listen 127.0.0.1:8080; |
42 server_name localhost; | 42 server_name localhost; |
43 | 43 |
44 location /njs { | |
45 js_content test.njs; | |
46 } | |
47 | |
44 location /test { | 48 location /test { |
45 js_content test.redirect; | 49 js_content test.redirect; |
46 } | 50 } |
47 | 51 |
48 location /redirect { | 52 location /redirect { |
57 } | 61 } |
58 | 62 |
59 EOF | 63 EOF |
60 | 64 |
61 $t->write_file('test.js', <<EOF); | 65 $t->write_file('test.js', <<EOF); |
66 function test_njs(r) { | |
67 r.return(200, njs.version); | |
68 } | |
69 | |
62 function redirect(r) { | 70 function redirect(r) { |
63 if (r.variables.arg_dest == 'named') { | 71 if (r.variables.arg_dest == 'named') { |
64 r.internalRedirect('\@named'); | 72 r.internalRedirect('\@named'); |
65 | 73 |
66 } else if (r.variables.arg_unsafe) { | 74 } else if (r.variables.arg_unsafe) { |
77 r.internalRedirect('/redirect'); | 85 r.internalRedirect('/redirect'); |
78 } | 86 } |
79 } | 87 } |
80 } | 88 } |
81 | 89 |
82 export default {redirect}; | 90 export default {njs:test_njs, redirect}; |
83 | 91 |
84 EOF | 92 EOF |
85 | 93 |
86 $t->try_run('no njs available')->plan(5); | 94 $t->try_run('no njs available')->plan(5); |
87 | 95 |