diff options
Diffstat (limited to 'nginx/t/js_fetch.t')
-rw-r--r-- | nginx/t/js_fetch.t | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/nginx/t/js_fetch.t b/nginx/t/js_fetch.t index 7ee1a602..76d9238d 100644 --- a/nginx/t/js_fetch.t +++ b/nginx/t/js_fetch.t @@ -52,10 +52,6 @@ http { js_content test.njs; } - location /engine { - js_content test.engine; - } - location /broken { js_content test.broken; } @@ -68,6 +64,10 @@ http { js_content test.body; } + location /body_content_length { + js_content test.body_content_length; + } + location /body_special { js_content test.body_special; } @@ -138,10 +138,6 @@ $t->write_file('test.js', <<EOF); r.return(200, njs.version); } - function engine(r) { - r.return(200, njs.engine); - } - function body(r) { var loc = r.args.loc; var getter = r.args.getter; @@ -164,6 +160,13 @@ $t->write_file('test.js', <<EOF); .catch(e => r.return(501, e.message)) } + async function body_content_length(r) { + let resp = await ngx.fetch(`http://127.0.0.1:$p0/loc`, + {headers: {'Content-Length': '100'}, + body: "CONTENT-BODY"}); + r.return(resp.status); + } + function property(r) { var opts = {headers:{}}; @@ -408,12 +411,12 @@ $t->write_file('test.js', <<EOF); export default {njs: test_njs, body, broken, broken_response, body_special, chain, chunked_ok, chunked_fail, header, header_iter, - host_header, multi, loc, property, engine}; + host_header, multi, loc, property, body_content_length }; EOF $t->try_run('no njs.fetch'); -$t->plan(37); +$t->plan(38); $t->run_daemon(\&http_daemon, port(8082)); $t->waitforsocket('127.0.0.1:' . port(8082)); @@ -516,6 +519,14 @@ like(http_get('/body_special?loc=head/large&method=HEAD'), qr/200 OK.*<empty>$/s, 'fetch head method large content-length'); } +TODO: { +local $TODO = 'not yet' unless has_version('0.9.1'); + +like(http_get('/body_content_length'), qr/200 OK/s, + 'fetch body content-length'); + +} + ############################################################################### sub has_version { |