aboutsummaryrefslogtreecommitdiff
path: root/nginx/t/js_periodic_fetch.t
diff options
context:
space:
mode:
Diffstat (limited to 'nginx/t/js_periodic_fetch.t')
-rw-r--r--nginx/t/js_periodic_fetch.t19
1 files changed, 5 insertions, 14 deletions
diff --git a/nginx/t/js_periodic_fetch.t b/nginx/t/js_periodic_fetch.t
index 0231b662..39385132 100644
--- a/nginx/t/js_periodic_fetch.t
+++ b/nginx/t/js_periodic_fetch.t
@@ -54,10 +54,6 @@ http {
js_periodic test.fetch_exception interval=1s;
}
- location /engine {
- js_content test.engine;
- }
-
location /fetch_ok {
return 200 'ok';
}
@@ -81,10 +77,6 @@ EOF
my $p0 = port(8080);
$t->write_file('test.js', <<EOF);
- function engine(r) {
- r.return(200, njs.engine);
- }
-
async function fetch() {
let reply = await ngx.fetch('http://127.0.0.1:$p0/fetch_ok');
let body = await reply.text();
@@ -107,16 +99,15 @@ $t->write_file('test.js', <<EOF);
}
function test_fetch(r) {
- r.return(200, ngx.shared.strings.get('fetch').startsWith('okok'));
+ r.return(200, ngx.shared.strings.get('fetch'));
}
function test_multiple_fetches(r) {
- r.return(200, ngx.shared.strings.get('multiple_fetches')
- .startsWith('ok\@foo'));
+ r.return(200, ngx.shared.strings.get('multiple_fetches'));
}
export default { fetch, fetch_exception, multiple_fetches, test_fetch,
- test_multiple_fetches, engine };
+ test_multiple_fetches };
EOF
$t->try_run('no js_periodic with fetch');
@@ -127,8 +118,8 @@ $t->plan(3);
select undef, undef, undef, 0.1;
-like(http_get('/test_fetch'), qr/true/, 'periodic fetch test');
-like(http_get('/test_multiple_fetches'), qr/true/, 'multiple fetch test');
+like(http_get('/test_fetch'), qr/(ok)+/, 'periodic fetch test');
+like(http_get('/test_multiple_fetches'), qr/ok\@foo/, 'multiple fetch test');
$t->stop();