Skip to content

Commit 41b87f3

Browse files
update reference.json (#404)
Co-authored-by: ryepup <[email protected]>
1 parent fa75d89 commit 41b87f3

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

reference-lib/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

reference-lib/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nginx/reference-lib",
3-
"version": "1.1.12",
3+
"version": "1.1.13",
44
"description": "",
55
"main": "dist/index.js",
66
"type": "module",

reference-lib/src/reference.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -4734,8 +4734,8 @@
47344734
"<p><em><code>function</code></em> | <em><code>module.function</code></em> [<em><code>buffer_type</code></em>=<em><code>string</code></em> | <em><code>buffer</code></em>]</p>\n"
47354735
],
47364736
"isBlock": false,
4737-
"description_md": "Sets an njs function as a response body filter.\nThe filter function is called for each data chunk of a response body\nwith the following arguments:\n\n- `r`\n\n the [HTTP request](https://nginx.org/en/docs/njs/reference.html#http) object\n- `data`\n\n the incoming data chunk,\n may be a string or Buffer\n depending on the `buffer_type` value,\n by default is a string.\n Since [0.8.5](https://nginx.org/en/docs/njs/changes.html#njs0.8.5), the\n `data` value is implicitly converted to a valid UTF-8 string\n by default.\n For binary data, the `buffer_type` value\n should be set to `buffer`.\n- `flags`\n\n an object with the following properties:\n - `last`\n \n a boolean value, true if data is a last buffer.\n\nThe filter function can pass its own modified version\nof the input data chunk to the next body filter by calling\n[`r.sendBuffer()`](https://nginx.org/en/docs/njs/reference.html#r_sendbuffer).\nFor example, to transform all the lowercase letters in the response body:\n```\nfunction filter(r, data, flags) {\n r.sendBuffer(data.toLowerCase(), flags);\n}\n```\nTo stop filtering (following data chunks will be passed to client\nwithout calling `js_body_filter`),\n[`r.done()`](https://nginx.org/en/docs/njs/reference.html#r_done)\ncan be used.\n\nIf the filter function changes the length of the response body, then\nit is required to clear out the \"Content-Length\" response header\n(if any) in\n[`js_header_filter`](https://nginx.org/en/docs/http/ngx_http_js_module.html#js_header_filter)\nto enforce chunked transfer encoding.\n\n> As the `js_body_filter` handler\n> returns its result immediately, it supports\n> only synchronous operations.\n> Thus, asynchronous operations such as\n> [r.subrequest()](https://nginx.org/en/docs/njs/reference.html#r_subrequest)\n> or\n> [setTimeout()](https://nginx.org/en/docs/njs/reference.html#settimeout)\n> are not supported.\n\n> The directive can be specified inside the\n> [if](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#if) block\n> since [0.7.7](https://nginx.org/en/docs/njs/changes.html#njs0.7.7).",
4738-
"description_html": "<p>Sets an njs function as a response body filter.\nThe filter function is called for each data chunk of a response body\nwith the following arguments:</p>\n\n<ul>\n<li><p><code>r</code></p>\n\n<p>the <a href=\"https://nginx.org/en/docs/njs/reference.html#http\" target=\"_blank\">HTTP request</a> object</p></li>\n\n<li><p><code>data</code></p>\n\n<p>the incoming data chunk,\nmay be a string or Buffer\ndepending on the <code>buffer_type</code> value,\nby default is a string.\nSince <a href=\"https://nginx.org/en/docs/njs/changes.html#njs0.8.5\" target=\"_blank\">0.8.5</a>, the\n<code>data</code> value is implicitly converted to a valid UTF-8 string\nby default.\nFor binary data, the <code>buffer_type</code> value\nshould be set to <code>buffer</code>.</p></li>\n\n<li><p><code>flags</code></p>\n\n<p>an object with the following properties:</p>\n\n<ul>\n<li><p><code>last</code></p>\n\n<p>a boolean value, true if data is a last buffer.</p></li>\n</ul></li>\n</ul>\n\n<p>The filter function can pass its own modified version\nof the input data chunk to the next body filter by calling\n<a href=\"https://nginx.org/en/docs/njs/reference.html#r_sendbuffer\" target=\"_blank\"><code>r.sendBuffer()</code></a>.\nFor example, to transform all the lowercase letters in the response body:</p>\n\n<pre><code>function filter(r, data, flags) {\n r.sendBuffer(data.toLowerCase(), flags);\n}\n</code></pre>\n\n<p>To stop filtering (following data chunks will be passed to client\nwithout calling <code>js_body_filter</code>),\n<a href=\"https://nginx.org/en/docs/njs/reference.html#r_done\" target=\"_blank\"><code>r.done()</code></a>\ncan be used.</p>\n\n<p>If the filter function changes the length of the response body, then\nit is required to clear out the &ldquo;Content-Length&rdquo; response header\n(if any) in\n<a href=\"https://nginx.org/en/docs/http/ngx_http_js_module.html#js_header_filter\" target=\"_blank\"><code>js_header_filter</code></a>\nto enforce chunked transfer encoding.</p>\n\n<blockquote>\n<p>As the <code>js_body_filter</code> handler\nreturns its result immediately, it supports\nonly synchronous operations.\nThus, asynchronous operations such as\n<a href=\"https://nginx.org/en/docs/njs/reference.html#r_subrequest\" target=\"_blank\">r.subrequest()</a>\nor\n<a href=\"https://nginx.org/en/docs/njs/reference.html#settimeout\" target=\"_blank\">setTimeout()</a>\nare not supported.</p>\n\n<p>The directive can be specified inside the\n<a href=\"https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#if\" target=\"_blank\">if</a> block\nsince <a href=\"https://nginx.org/en/docs/njs/changes.html#njs0.7.7\" target=\"_blank\">0.7.7</a>.</p>\n</blockquote>\n"
4737+
"description_md": "Sets an njs function as a response body filter.\nThe filter function is called for each data chunk of a response body\nwith the following arguments:\n\n- `r`\n\n the [HTTP request](https://nginx.org/en/docs/njs/reference.html#http) object\n- `data`\n\n the incoming data chunk,\n may be a string or Buffer\n depending on the `buffer_type` value,\n by default is a string.\n Since [0.8.5](https://nginx.org/en/docs/njs/changes.html#njs0.8.5), the\n `data` value is implicitly converted to a valid UTF-8 string\n by default.\n For binary data, the `buffer_type` value\n should be set to `buffer`.\n- `flags`\n\n an object with the following properties:\n - `last`\n \n a boolean value, true if data is a last buffer.\n\nThe filter function can pass its own modified version\nof the input data chunk to the next body filter by calling\n[`r.sendBuffer()`](https://nginx.org/en/docs/njs/reference.html#r_sendbuffer).\nFor example, to transform all the lowercase letters in the response body:\n```\nfunction filter(r, data, flags) {\n r.sendBuffer(data.toLowerCase(), flags);\n}\n```\n\nIf the filter function changes the length of the response body, the\n\"Content-Length\" response header (if present) should be cleared\nin [`js_header_filter`](https://nginx.org/en/docs/http/ngx_http_js_module.html#js_header_filter)\nto enforce chunked transfer encoding:\n```\nexample.conf:\n location /foo {\n # proxy_pass http://localhost:8080;\n\n js_header_filter main.clear_content_length;\n js_body_filter main.filter;\n }\n\nexample.js:\n function clear_content_length(r) {\n delete r.headersOut['Content-Length'];\n }\n```\n\nTo stop filtering and pass the data chunks to the client\nwithout calling `js_body_filter`,\n[`r.done()`](https://nginx.org/en/docs/njs/reference.html#r_done)\ncan be used.\nFor example, to prepend some data to the response body:\n```\nfunction prepend(r, data, flags) {\n r.sendBuffer(\"XXX\");\n r.sendBuffer(data, flags);\n r.done();\n}\n```\n\n> As the `js_body_filter` handler\n> returns its result immediately, it supports\n> only synchronous operations.\n> Thus, asynchronous operations such as\n> [r.subrequest()](https://nginx.org/en/docs/njs/reference.html#r_subrequest)\n> or\n> [setTimeout()](https://nginx.org/en/docs/njs/reference.html#settimeout)\n> are not supported.\n\n> The directive can be specified inside the\n> [if](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#if) block\n> since [0.7.7](https://nginx.org/en/docs/njs/changes.html#njs0.7.7).",
4738+
"description_html": "<p>Sets an njs function as a response body filter.\nThe filter function is called for each data chunk of a response body\nwith the following arguments:</p>\n\n<ul>\n<li><p><code>r</code></p>\n\n<p>the <a href=\"https://nginx.org/en/docs/njs/reference.html#http\" target=\"_blank\">HTTP request</a> object</p></li>\n\n<li><p><code>data</code></p>\n\n<p>the incoming data chunk,\nmay be a string or Buffer\ndepending on the <code>buffer_type</code> value,\nby default is a string.\nSince <a href=\"https://nginx.org/en/docs/njs/changes.html#njs0.8.5\" target=\"_blank\">0.8.5</a>, the\n<code>data</code> value is implicitly converted to a valid UTF-8 string\nby default.\nFor binary data, the <code>buffer_type</code> value\nshould be set to <code>buffer</code>.</p></li>\n\n<li><p><code>flags</code></p>\n\n<p>an object with the following properties:</p>\n\n<ul>\n<li><p><code>last</code></p>\n\n<p>a boolean value, true if data is a last buffer.</p></li>\n</ul></li>\n</ul>\n\n<p>The filter function can pass its own modified version\nof the input data chunk to the next body filter by calling\n<a href=\"https://nginx.org/en/docs/njs/reference.html#r_sendbuffer\" target=\"_blank\"><code>r.sendBuffer()</code></a>.\nFor example, to transform all the lowercase letters in the response body:</p>\n\n<pre><code>function filter(r, data, flags) {\n r.sendBuffer(data.toLowerCase(), flags);\n}\n</code></pre>\n\n<p>If the filter function changes the length of the response body, the\n&ldquo;Content-Length&rdquo; response header (if present) should be cleared\nin <a href=\"https://nginx.org/en/docs/http/ngx_http_js_module.html#js_header_filter\" target=\"_blank\"><code>js_header_filter</code></a>\nto enforce chunked transfer encoding:</p>\n\n<pre><code>example.conf:\n location /foo {\n # proxy_pass http://localhost:8080;\n\n js_header_filter main.clear_content_length;\n js_body_filter main.filter;\n }\n\nexample.js:\n function clear_content_length(r) {\n delete r.headersOut['Content-Length'];\n }\n</code></pre>\n\n<p>To stop filtering and pass the data chunks to the client\nwithout calling <code>js_body_filter</code>,\n<a href=\"https://nginx.org/en/docs/njs/reference.html#r_done\" target=\"_blank\"><code>r.done()</code></a>\ncan be used.\nFor example, to prepend some data to the response body:</p>\n\n<pre><code>function prepend(r, data, flags) {\n r.sendBuffer(&quot;XXX&quot;);\n r.sendBuffer(data, flags);\n r.done();\n}\n</code></pre>\n\n<blockquote>\n<p>As the <code>js_body_filter</code> handler\nreturns its result immediately, it supports\nonly synchronous operations.\nThus, asynchronous operations such as\n<a href=\"https://nginx.org/en/docs/njs/reference.html#r_subrequest\" target=\"_blank\">r.subrequest()</a>\nor\n<a href=\"https://nginx.org/en/docs/njs/reference.html#settimeout\" target=\"_blank\">setTimeout()</a>\nare not supported.</p>\n\n<p>The directive can be specified inside the\n<a href=\"https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#if\" target=\"_blank\">if</a> block\nsince <a href=\"https://nginx.org/en/docs/njs/changes.html#njs0.7.7\" target=\"_blank\">0.7.7</a>.</p>\n</blockquote>\n"
47394739
},
47404740
{
47414741
"name": "js_content",
@@ -16849,5 +16849,5 @@
1684916849
]
1685016850
}
1685116851
],
16852-
"version": "https://github.com/nginx/nginx.org/commit/47117cd87beed1b8f92857e46a66f3e8e514cf07"
16852+
"version": "https://github.com/nginx/nginx.org/commit/c909feafd3a680a3c65d0534af5835d7128c1e36"
1685316853
}

0 commit comments

Comments
 (0)