From: Dmitry Volyntsev Date: Sat, 18 Jan 2025 01:19:00 +0000 (-0800) Subject: Tests: moving request body tests to js_request_body.t. X-Git-Tag: 0.8.10~51 X-Git-Url: http://www.kaiwu.me/postgresql/commit/static/gitweb.js?a=commitdiff_plain;h=e92e2af9768ef327a5aacb4aa97746213dcdad52;p=njs.git Tests: moving request body tests to js_request_body.t. --- diff --git a/nginx/t/js.t b/nginx/t/js.t index b7dfe3e6..a8bdab96 100644 --- a/nginx/t/js.t +++ b/nginx/t/js.t @@ -83,15 +83,6 @@ http { return 200 $test_global; } - location /body { - js_content test.request_body; - } - - location /in_file { - client_body_in_file_only on; - js_content test.request_body; - } - location /status { js_content test.status; } @@ -100,14 +91,6 @@ http { js_content test.buffer_variable; } - location /request_body { - js_content test.request_body; - } - - location /request_body_cache { - js_content test.request_body_cache; - } - location /send { js_content test.send; } @@ -194,22 +177,6 @@ $t->write_file('test.js', <write_file('test.js', <try_run('no njs available')->plan(29); +$t->try_run('no njs available')->plan(25); ############################################################################### @@ -289,12 +255,6 @@ like(http_get('/uri'), qr/uri=\/uri/, 'r.uri'); like(http_get('/status'), qr/204 No Content/, 'r.status'); -like(http_post('/body'), qr/REQ-BODY/, 'request body'); -like(http_post('/in_file'), qr/request body is in a file/, - 'request body in file'); -like(http_post_big('/body'), qr/200.*^(1234567890){1024}$/ms, - 'request body big'); - like(http_get('/send?foo=12345&n=11&foo-2=bar&ndd=&foo-3=z'), qr/n=foo, v=12 n=foo-2, v=ba n=foo-3, v=z/, 'r.send'); @@ -323,8 +283,6 @@ like(http_post('/type?path=requestText'), qr/200 OK.*type: string$/s, 'requestText type'); like(http_post('/type?path=requestBuffer'), qr/200 OK.*type: buffer$/s, 'requestBuffer type'); -like(http_post('/request_body_cache'), - qr/requestText:string requestBuffer:buffer$/s, 'request body cache'); like(http_get('/var'), qr/variable=127.0.0.1/, 'r.variables'); like(http_get('/global'), qr/global=njs/, 'global code'); @@ -414,16 +372,4 @@ sub http_post { return http($p, %extra); } -sub http_post_big { - my ($url, %extra) = @_; - - my $p = "POST $url HTTP/1.0" . CRLF . - "Host: localhost" . CRLF . - "Content-Length: 10240" . CRLF . - CRLF . - ("1234567890" x 1024); - - return http($p, %extra); -} - ############################################################################### diff --git a/nginx/t/js_request_body.t b/nginx/t/js_request_body.t index 7a5005d4..360e4565 100644 --- a/nginx/t/js_request_body.t +++ b/nginx/t/js_request_body.t @@ -56,6 +56,10 @@ http { client_body_in_file_only clean; js_content test.read_body_from_temp_file; } + + location /request_body_cache { + js_content test.request_body_cache; + } } } @@ -79,11 +83,17 @@ $t->write_file('test.js', <try_run('no njs request body')->plan(4); +$t->try_run('no njs request body')->plan(5); ############################################################################### @@ -94,6 +104,8 @@ like(http_post_big('/body'), qr/200.*^(1234567890){1024}$/ms, 'request body big'); like(http_post_big('/read_body_from_temp_file'), qr/200.*^(1234567890){1024}$/ms, 'request body big from temp file'); +like(http_post('/request_body_cache'), + qr/requestText:string requestBuffer:buffer$/s, 'request body cache'); ###############################################################################