Welcome! Log In Create A New Profile

Advanced

[njs] HTTP: renaming reqBody, resBody to requestBuffer and responseBuffer.

Dmitry Volyntsev
November 27, 2020 08:14AM
details: https://hg.nginx.org/njs/rev/a8cb5f47bfea
branches:
changeset: 1576:a8cb5f47bfea
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Fri Nov 27 12:28:44 2020 +0000
description:
HTTP: renaming reqBody,resBody to requestBuffer and responseBuffer.

In 434f20c29f4c, r.reqBody and r.resBody were introduced. Since quite
often request body and response body are valid strings, it is preferable
to leave both variants to avoid potential conversions.

To make distinction clearer, requestText and responseText aliases to
requestBody and responseBody were also added.

diffstat:

nginx/ngx_http_js_module.c | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r fac7e5dc8009 -r a8cb5f47bfea nginx/ngx_http_js_module.c
--- a/nginx/ngx_http_js_module.c Thu Nov 26 21:43:17 2020 +0300
+++ b/nginx/ngx_http_js_module.c Fri Nov 27 12:28:44 2020 +0000
@@ -328,10 +328,19 @@ static njs_external_t ngx_http_js_ext_r

{
.flags = NJS_EXTERN_PROPERTY,
- .name.string = njs_str("reqBody"),
+ .name.string = njs_str("requestText"),
.enumerable = 1,
.u.property = {
.handler = ngx_http_js_ext_get_request_body,
+ .magic32 = NGX_JS_STRING,
+ }
+ },
+
+ {
+ .flags = NJS_EXTERN_PROPERTY,
+ .name.string = njs_str("requestBuffer"),
+ .u.property = {
+ .handler = ngx_http_js_ext_get_request_body,
.magic32 = NGX_JS_BUFFER,
}
},
@@ -355,10 +364,19 @@ static njs_external_t ngx_http_js_ext_r

{
.flags = NJS_EXTERN_PROPERTY,
- .name.string = njs_str("resBody"),
+ .name.string = njs_str("responseText"),
.enumerable = 1,
.u.property = {
.handler = ngx_http_js_ext_get_response_body,
+ .magic32 = NGX_JS_STRING,
+ }
+ },
+
+ {
+ .flags = NJS_EXTERN_PROPERTY,
+ .name.string = njs_str("responseBuffer"),
+ .u.property = {
+ .handler = ngx_http_js_ext_get_response_body,
.magic32 = NGX_JS_BUFFER,
}
},
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] HTTP: renaming reqBody, resBody to requestBuffer and responseBuffer.

Dmitry Volyntsev 604 November 27, 2020 08:14AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 276
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready