# HG changeset patch # User Dmitry Volyntsev # Date 1532535942 -10800 # Node ID 28ba4b465635f7e62be1491e373128d1a9afd905 # Parent 71f964c077bf22f65867545d79244bbc0a9247d2 Tests: more njs subrequest tests. diff --git a/js_subrequests.t b/js_subrequests.t --- a/js_subrequests.t +++ b/js_subrequests.t @@ -51,6 +51,10 @@ http { listen 127.0.0.1:8080; server_name localhost; + location /njs { + js_content test_njs; + } + location /sr { js_content sr; } @@ -147,6 +151,14 @@ http { js_content sr_except_invalid_options_header_only; } + location /sr_js_in_sr_parent { + js_content sr_js_in_sr_parent; + } + + location /sr_in_sr_callback { + js_content sr_in_sr_callback; + } + location /sr_uri_except { js_content sr_uri_except; } @@ -178,6 +190,10 @@ http { proxy_pass http://127.0.0.1:8084/; } + location /sr_parent { + js_content sr_parent; + } + location /js_sub { js_content js_sub; } @@ -228,6 +244,9 @@ http { EOF $t->write_file('test.js', <write_file('t', '["SEE-THIS"]'); -$t->try_run('no njs available')->plan(23); +$t->try_run('no njs available')->plan(25); $t->run_daemon(\&http_daemon); ############################################################################### @@ -467,6 +516,23 @@ http_get('/sr_except_failed_to_convert_o http_get('/sr_except_invalid_options_method'); http_get('/sr_uri_except'); +TODO: { +local $TODO = 'not yet' + unless http_get('/njs') =~ /^([.0-9]+)$/m && $1 ge '0.2.4'; + +is(get_json('/sr_js_in_sr_parent'), + '{"e":"parent can only be returned for a subrequest"}', + 'parent in subrequest js_content'); + +todo_skip 'leaves coredump', 1 + unless http_get('/njs') =~ /^([.0-9]+)$/m && $1 ge '0.2.4'; + +is(get_json('/sr_in_sr_callback'), + '{"e":"subrequest can only be created for the primary request"}', + 'subrequest for non-primary request'); + +} + $t->stop(); ok(index($t->read_file('error.log'), 'callback is not a function') > 0,