aboutsummaryrefslogtreecommitdiff
path: root/nginx/t/js_fetch.t
diff options
context:
space:
mode:
Diffstat (limited to 'nginx/t/js_fetch.t')
-rw-r--r--nginx/t/js_fetch.t23
1 files changed, 21 insertions, 2 deletions
diff --git a/nginx/t/js_fetch.t b/nginx/t/js_fetch.t
index 1c6fde77..76d9238d 100644
--- a/nginx/t/js_fetch.t
+++ b/nginx/t/js_fetch.t
@@ -64,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;
}
@@ -156,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:{}};
@@ -400,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};
+ 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));
@@ -508,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 {