diff options
author | Dmitry Volyntsev <xeioex@nginx.com> | 2020-11-27 12:28:44 +0000 |
---|---|---|
committer | Dmitry Volyntsev <xeioex@nginx.com> | 2020-11-27 12:28:44 +0000 |
commit | 65c2a47abdb76a7ff861590746f08a2833d91b88 (patch) | |
tree | 7cc3a9a7381ff09336b4f4981df695b86ad9f145 /nginx/ngx_http_js_module.c | |
parent | eb24b770caf868b5892f05080d07c8843ef134ae (diff) | |
download | njs-65c2a47abdb76a7ff861590746f08a2833d91b88.tar.gz njs-65c2a47abdb76a7ff861590746f08a2833d91b88.zip |
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 (limited to 'nginx/ngx_http_js_module.c')
-rw-r--r-- | nginx/ngx_http_js_module.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/nginx/ngx_http_js_module.c b/nginx/ngx_http_js_module.c index a576fab5..9a6c5cd9 100644 --- a/nginx/ngx_http_js_module.c +++ b/nginx/ngx_http_js_module.c @@ -328,10 +328,19 @@ static njs_external_t ngx_http_js_ext_request[] = { { .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_request[] = { { .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, } }, |