Mercurial > hg > nginx-site
changeset 2675:893cd7724c8c
Documented the "r" argument for js_body_filter.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Tue, 09 Mar 2021 18:44:56 +0000 |
parents | e87c0ffc3492 |
children | 468e6e14e5cc |
files | xml/en/docs/http/ngx_http_js_module.xml xml/ru/docs/http/ngx_http_js_module.xml |
diffstat | 2 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/xml/en/docs/http/ngx_http_js_module.xml +++ b/xml/en/docs/http/ngx_http_js_module.xml @@ -9,7 +9,7 @@ <module name="Module ngx_http_js_module" link="/en/docs/http/ngx_http_js_module.html" lang="en" - rev="24"> + rev="25"> <section id="summary"> @@ -132,6 +132,11 @@ The filter function is called for each d with the following arguments: <list type="tag"> +<tag-name><literal>r</literal></tag-name> +<tag-desc> +the <link doc="../njs/reference.xml" id="http">HTTP request</link> object +</tag-desc> + <tag-name><literal>data</literal></tag-name> <tag-desc> the incoming data chunk, @@ -161,7 +166,7 @@ of the input data chunk to the next body <link doc="../njs/reference.xml" id="r_sendbuffer"><literal>r.sendBuffer()</literal></link>. For example, to transform all the lowercase letters in the response body: <example> -function filter(data, flags) { +function filter(r, data, flags) { r.sendBuffer(data.toLowerCase(), flags); } </example>
--- a/xml/ru/docs/http/ngx_http_js_module.xml +++ b/xml/ru/docs/http/ngx_http_js_module.xml @@ -9,7 +9,7 @@ <module name="Модуль ngx_http_js_module" link="/ru/docs/http/ngx_http_js_module.html" lang="ru" - rev="24"> + rev="25"> <section id="summary"> @@ -132,6 +132,11 @@ export default {foo, summary, baz, hello со следующими аргументами: <list type="tag"> +<tag-name><literal>r</literal></tag-name> +<tag-desc> +объект <link doc="../njs/reference.xml" id="http">HTTP request</link> +</tag-desc> + <tag-name><literal>data</literal></tag-name> <tag-desc> входящий блок данных @@ -161,7 +166,7 @@ export default {foo, summary, baz, hello <link doc="../njs/reference.xml" id="r_sendbuffer"><literal>r.sendBuffer()</literal></link>. Пример преобразования букв в нижний регистр в теле ответа: <example> -function filter(data, flags) { +function filter(r, data, flags) { r.sendBuffer(data.toLowerCase(), flags); } </example>