Mercurial > hg > nginx-tests
comparison js_subrequests.t @ 1533:41dcbcf3381a
Tests: adapted js_subrequests.t to njs changes after 0.3.7.
author | Dmitry Volyntsev <xeioex@nginx.com> |
---|---|
date | Fri, 22 Nov 2019 20:45:03 +0300 |
parents | 9521130f6f22 |
children | 0b97d431571f |
comparison
equal
deleted
inserted
replaced
1532:9d5996c3f5b8 | 1533:41dcbcf3381a |
---|---|
143 js_content sr_except_failed_to_convert_options_arg; | 143 js_content sr_except_failed_to_convert_options_arg; |
144 } | 144 } |
145 | 145 |
146 location /sr_except_invalid_options_header_only { | 146 location /sr_except_invalid_options_header_only { |
147 js_content sr_except_invalid_options_header_only; | 147 js_content sr_except_invalid_options_header_only; |
148 } | |
149 | |
150 location /sr_js_in_sr_parent { | |
151 js_content sr_js_in_sr_parent; | |
152 } | 148 } |
153 | 149 |
154 location /sr_in_sr_callback { | 150 location /sr_in_sr_callback { |
155 js_content sr_in_sr_callback; | 151 js_content sr_in_sr_callback; |
156 } | 152 } |
373 | 369 |
374 function sr_js_in_subrequest(r) { | 370 function sr_js_in_subrequest(r) { |
375 r.subrequest('/js_sub', body_fwd_cb); | 371 r.subrequest('/js_sub', body_fwd_cb); |
376 } | 372 } |
377 | 373 |
378 function sr_js_in_sr_parent(r) { | |
379 r.subrequest('/sr_parent', body_fwd_cb); | |
380 } | |
381 | |
382 function sr_in_sr_callback(r) { | 374 function sr_in_sr_callback(r) { |
383 r.subrequest('/return', function (reply) { | 375 r.subrequest('/return', function (reply) { |
384 try { | 376 try { |
385 reply.subrequest('/return'); | 377 reply.subrequest('/return'); |
386 | 378 |
466 | 458 |
467 EOF | 459 EOF |
468 | 460 |
469 $t->write_file('t', '["SEE-THIS"]'); | 461 $t->write_file('t', '["SEE-THIS"]'); |
470 | 462 |
471 $t->try_run('no njs available')->plan(25); | 463 $t->try_run('no njs available')->plan(24); |
472 $t->run_daemon(\&http_daemon); | 464 $t->run_daemon(\&http_daemon); |
473 | 465 |
474 ############################################################################### | 466 ############################################################################### |
475 | 467 |
476 is(get_json('/sr'), '[{"status":404,"uri":"/p/sub2"}]', 'sr'); | 468 is(get_json('/sr'), '[{"status":404,"uri":"/p/sub2"}]', 'sr'); |
523 http_get('/sr_too_large'); | 515 http_get('/sr_too_large'); |
524 http_get('/sr_except_not_a_func'); | 516 http_get('/sr_except_not_a_func'); |
525 http_get('/sr_except_failed_to_convert_arg'); | 517 http_get('/sr_except_failed_to_convert_arg'); |
526 http_get('/sr_except_failed_to_convert_options_arg'); | 518 http_get('/sr_except_failed_to_convert_options_arg'); |
527 http_get('/sr_uri_except'); | 519 http_get('/sr_uri_except'); |
528 | |
529 is(get_json('/sr_js_in_sr_parent'), | |
530 '{"e":"parent can only be returned for a subrequest"}', | |
531 'parent in subrequest js_content'); | |
532 | 520 |
533 is(get_json('/sr_in_sr_callback'), | 521 is(get_json('/sr_in_sr_callback'), |
534 '{"e":"subrequest can only be created for the primary request"}', | 522 '{"e":"subrequest can only be created for the primary request"}', |
535 'subrequest for non-primary request'); | 523 'subrequest for non-primary request'); |
536 | 524 |