changeset 1557:b194552fcc21

Tests: adapted js_subrequests.t to njs changes after 0.4.0. Since 0.4.0, external objects support implicit convertion to string. To cope with that, they are replaced with a symbol value which does not support implicit conversion to string.
author Dmitry Volyntsev <xeioex@nginx.com>
date Wed, 18 Mar 2020 17:44:37 +0300
parents 3ff92feb99d1
children e9096949d5f5
files js_subrequests.t
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/js_subrequests.t
+++ b/js_subrequests.t
@@ -307,8 +307,7 @@ EOF
 
     function sr_options_method_head(r) {
         r.subrequest('/p/method', {method:'HEAD'}, reply => {
-            r.return(200, JSON.stringify({c:reply.status,
-                                          s:reply.responseBody.length}));
+            r.return(200, JSON.stringify({c:reply.status}));
         });
     }
 
@@ -462,7 +461,7 @@ EOF
     }
 
     function sr_except_failed_to_convert_arg(r) {
-        r.subrequest('/sub1', r.args, ()=>{});
+        r.subrequest('/sub1', Symbol.toStringTag, ()=>{});
     }
 
     function sr_except_failed_to_convert_options_arg(r) {
@@ -470,7 +469,7 @@ EOF
     }
 
     function sr_uri_except(r) {
-        r.subrequest(r, 'a=1', 'b');
+        r.subrequest(Symbol.toStringTag, 'a=1', 'b');
     }
 
     function body_fwd_cb(r) {
@@ -496,8 +495,7 @@ is(get_json('/sr_options_args'), '{"h":"
 is(get_json('/sr_options_method?m=POST'), '["POST"]', 'sr method POST');
 is(get_json('/sr_options_method?m=PURGE'), '["PURGE"]', 'sr method PURGE');
 is(get_json('/sr_options_body'), '["REQ-BODY"]', 'sr_options_body');
-is(get_json('/sr_options_method_head'), '{"c":200,"s":0}',
-	'sr_options_method_head');
+is(get_json('/sr_options_method_head'), '{"c":200}', 'sr_options_method_head');
 is(get_json('/sr_body'), '{"a":{"b":1}}', 'sr_body');
 is(get_json('/sr_body_special'), '{"e":"msg"}', 'sr_body_special');
 is(get_json('/sr_in_variable_handler'), '["CB-VAR"]', 'sr_in_variable_handler');