Mercurial > hg > nginx-tests
changeset 1342:5833f3b7a884
Tests: adapted js_request_body.t for renamed property.
r.body -> r.requestBody.
author | Dmitry Volyntsev <xeioex@nginx.com> |
---|---|
date | Wed, 13 Jun 2018 13:57:38 +0300 |
parents | 15f0d9412b22 |
children | 2ff483941037 |
files | js_request_body.t |
diffstat | 1 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/js_request_body.t Wed Jun 13 13:57:30 2018 +0300 +++ b/js_request_body.t Wed Jun 13 13:57:38 2018 +0300 @@ -1,9 +1,9 @@ #!/usr/bin/perl -# (C) Dmitry Volyntsev. +# (C) Dmitry Volyntsev # (C) Nginx, Inc. -# Tests for http JavaScript module, req.body method. +# Tests for http njs module, req.requestBody method. ############################################################################### @@ -61,17 +61,17 @@ EOF $t->write_file('test.js', <<EOF); - function test_njs(req, res) { - res.return(200, njs.version); + function test_njs(r) { + r.return(200, njs.version); } - function test_body(req) { + function test_body(r) { try { - var body = req.body; - req.response.return(200, body); + var body = r.requestBody; + r.return(200, body); } catch (e) { - req.response.return(500, e.message); + r.return(500, e.message); } } @@ -82,8 +82,8 @@ ############################################################################### TODO: { -local $TODO = 'not yet' - unless http_get('/njs') =~ /^([.0-9]+)$/m && $1 ge '0.2.1'; +local $TODO = 'deprecated api' + unless http_get('/njs') =~ /^([.0-9]+)$/m && $1 ge '0.2.2'; 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');