diff js_request_body.t @ 1751:18ac4d9e5a2a

Tests: rewriting njs tests without deprecated "js_include".
author Dmitry Volyntsev <xeioex@nginx.com>
date Thu, 09 Dec 2021 17:36:29 +0000
parents bc0990ea2e5b
children 386748f328b1
line wrap: on
line diff
--- a/js_request_body.t
+++ b/js_request_body.t
@@ -37,19 +37,19 @@ events {
 http {
     %%TEST_GLOBALS_HTTP%%
 
-    js_include test.js;
+    js_import test.js;
 
     server {
         listen       127.0.0.1:8080;
         server_name  localhost;
 
         location /body {
-            js_content test_body;
+            js_content test.body;
         }
 
         location /in_file {
             client_body_in_file_only on;
-            js_content test_body;
+            js_content test.body;
         }
     }
 }
@@ -57,7 +57,7 @@ http {
 EOF
 
 $t->write_file('test.js', <<EOF);
-    function test_body(r) {
+    function body(r) {
         try {
             var body = r.requestBody;
             r.return(200, body);
@@ -67,6 +67,8 @@ EOF
         }
     }
 
+    export default {body};
+
 EOF
 
 $t->try_run('no njs request body')->plan(3);