You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/04/20 08:49:51 UTC

[GitHub] [apisix] hf400159 opened a new pull request, #6891: Hftransformation

hf400159 opened a new pull request, #6891:
URL: https://github.com/apache/apisix/pull/6891

   ### Description
   
   Updates the documentation of the "General" Plugins.
   
   Fixes issue    [6833](https://github.com/apache/apisix/issues/6833.)
   
   ### Checklist
   
   - [ ] I have explained the need for this PR and the problem it solves
   - [ ] I have explained the changes or the new features added to this PR
   - [ ] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #6891:
URL: https://github.com/apache/apisix/pull/6891#discussion_r854751272


##########
docs/zh/latest/plugins/grpc-transcode.md:
##########
@@ -75,14 +100,15 @@ protoc --include_imports --descriptor_set_out=proto.pb proto/helloworld.proto
 
 然后我们可以将 `proto.pb` 的内容作为 proto 的 `content` 字段提交。
 
-由于内容是二进制的,我们需要先对其进行 base64 编码。这里我们用一个 Python 脚本来做。
+由于 proto 的内容是二进制的,我们需要使用以下 Python 脚本将其转换成 `base64`:

Review Comment:
   ```suggestion
   由于 proto 的内容是二进制的,我们需要使用以下 Python 脚本将其转换成 `base64` 格式:
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #6891:
URL: https://github.com/apache/apisix/pull/6891#discussion_r854748011


##########
docs/zh/latest/plugins/fault-injection.md:
##########
@@ -23,23 +29,33 @@ title: fault-injection
 
 ## 描述
 
-故障注入插件,该插件可以和其他插件一起使用,并且会在其他插件前被执行,配置 `abort` 参数将直接返回给客户端指定的响应码并且终止其他插件的执行,配置 `delay` 参数将延迟某个请求,并且还会执行配置的其他插件。
+`fault-injection` 插件,该插件可以和其他插件一起使用,并且会在其他插件前被执行。
+
+`abort` 属性将直接返回给客户端指定的响应码并且终止其他插件的执行。
+
+`delay` 属性将延迟某个请求,并且还会执行配置的其他插件。
 
 ## 属性
 
-| 名称              | 类型    | 必选项 | 默认值 | 有效值     | 描述                       |
-| ----------------- | ------- | ------ | ------ | ---------- | -------------------------- |
-| abort.http_status | integer | 必需   |        | [200, ...] | 返回给客户端的 http 状态码 |
-| abort.body        | string  | 可选   |        |            | 返回给客户端的响应数据。支持使用 Nginx 变量,如 `client addr: $remote_addr\n`|
-| abort.percentage  | integer | 可选   |        | [0, 100]   | 将被中断的请求占比         |
-| abort.vars        | array[] | 可选   |        |            | 执行故障注入的规则,当规则匹配通过后才会执行故障注。`vars` 是一个表达式的列表,来自 [lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list)。 |
-| delay.duration    | number  | 必需   |        |            | 延迟时间,可以指定小数     |
-| delay.percentage  | integer | 可选   |        | [0, 100]   | 将被延迟的请求占比         |
-| delay.vars        | array[] | 可选   |        |            | 执行请求延迟的规则,当规则匹配通过后才会延迟请求。`vars` 是一个表达式列表,来自 [lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list)。   |
+| 名称              | 类型    | 必选项 | 有效值     | 描述                       |
+| ----------------- | ------- | ---- |  ---------- | -------------------------- |
+| abort.http_status | integer | 是   |  [200, ...] | 返回给客户端的 HTTP 状态码 |
+| abort.body        | string  | 否   |             | 返回给客户端的响应数据。支持使用 NGINX 变量,如 `client addr: $remote_addr\n`|
+| abort.percentage  | integer | 否   |  [0, 100]   | 将被中断的请求占比         |
+| abort.vars        | array[] | 否   |             | 执行故障注入的规则,当规则匹配通过后才会执行故障注。`vars` 是一个表达式的列表,来自 [lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list)。 |
+| delay.duration    | number  | 是   |             | 延迟时间,可以指定小数     |
+| delay.percentage  | integer | 否   |  [0, 100]   | 将被延迟的请求占比         |
+| delay.vars        | array[] | 否   |             | 执行请求延迟的规则,当规则匹配通过后才会延迟请求。`vars` 是一个表达式列表,来自 [lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list)。   |
+
+:::info IMPORTANT
+
+`abort` 和 `delay` 属性至少要配置一个。

Review Comment:
   ```suggestion
   - `abort` 属性将直接返回给客户端指定的响应码并且终止其他插件的执行。
   - `delay` 属性将延迟某个请求,并且还会执行配置的其他插件。
   - `abort` 和 `delay` 属性至少要配置一个。
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #6891:
URL: https://github.com/apache/apisix/pull/6891#discussion_r854753085


##########
docs/zh/latest/plugins/mocking.md:
##########
@@ -23,22 +29,29 @@ title: mocking
 
 ## 描述
 
-Mock API 插件,绑定该插件后将随机返回指定格式的`mock`数据,不再转发到后端。
+`mocking` 插件用于 Mock API。当执行该插件时,它将随机返回指定格式的模拟数据,并且请求不会转发到上游。

Review Comment:
   ```suggestion
   `mocking` 插件用于处理 Mock API 相关。当执行该插件时,它将随机返回指定格式的模拟数据,并且请求不会转发到上游。
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on PR #6891:
URL: https://github.com/apache/apisix/pull/6891#issuecomment-1108159405

   LGTM


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #6891:
URL: https://github.com/apache/apisix/pull/6891#discussion_r854747878


##########
docs/zh/latest/plugins/fault-injection.md:
##########
@@ -23,23 +29,33 @@ title: fault-injection
 
 ## 描述
 
-故障注入插件,该插件可以和其他插件一起使用,并且会在其他插件前被执行,配置 `abort` 参数将直接返回给客户端指定的响应码并且终止其他插件的执行,配置 `delay` 参数将延迟某个请求,并且还会执行配置的其他插件。
+`fault-injection` 插件,该插件可以和其他插件一起使用,并且会在其他插件前被执行。
+
+`abort` 属性将直接返回给客户端指定的响应码并且终止其他插件的执行。
+
+`delay` 属性将延迟某个请求,并且还会执行配置的其他插件。

Review Comment:
   ```suggestion
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #6891:
URL: https://github.com/apache/apisix/pull/6891#discussion_r854749662


##########
docs/zh/latest/plugins/grpc-transcode.md:
##########
@@ -23,20 +29,40 @@ title: grpc-transcode
 
 ## 描述
 
-HTTP(s) -> APISIX -> gRPC server
+`grpc-transcode` 插件可以在 HTTP 和 gRPC 请求之间进行转换。

Review Comment:
   ```suggestion
   使用 `grpc-transcode` 插件可以在 HTTP 和 gRPC 请求之间进行转换。
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #6891:
URL: https://github.com/apache/apisix/pull/6891#discussion_r854754116


##########
docs/zh/latest/plugins/mocking.md:
##########
@@ -23,22 +29,29 @@ title: mocking
 
 ## 描述
 
-Mock API 插件,绑定该插件后将随机返回指定格式的`mock`数据,不再转发到后端。
+`mocking` 插件用于 Mock API。当执行该插件时,它将随机返回指定格式的模拟数据,并且请求不会转发到上游。
 
 ## 属性
 
-| 名称            | 类型    | 必选项 | 默认值 | 有效值                                                            | 描述                                                                                                                                              |
-| -------------   | -------| ----- | ----- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
-| delay           | integer | 可选 |        |                                                                 | 延时返回的时间,单位为秒                                            |
-| response_status | integer| 可选  | 200 |                                                                 | 返回的响应 http status code                                            |
-| content_type    | string | 可选  | application/json |                                                                 | 返回的响应头的 Content-Type。                                            |
-| response_example| string | 可选  |        |                                                                 | 返回的响应体,与`response_schema`字段二选一                                            |
-| response_schema | object | 可选  |        |                                                                 | 指定响应的`jsonschema`对象,未指定`response_example`字段时生效,具体结构看后文说明                                            |
-| with_mock_header | boolean | 可选 | true  |                                                                 | 是否返回响应头:"x-mock-by: APISIX/{version}",默认返回,指定为 false 则不返回        |
+| 名称            | 类型    | 必选项 | 默认值           |  描述                                                           |
+| -------------   | -------| ----- | ---------------- | --------------------------------------------------------------------------- |
+| delay           | integer| 否    |                  | 延时返回的时间,单位为秒。                                            |
+| response_status | integer| 否    | 200              | 返回响应的 HTTP 状态码。                                            |
+| content_type    | string | 否    | application/json | 返回响应的 Header `Content-Type`。                                            |
+| response_example| string | 否    |                  | 返回响应的 Body,与 `response_schema` 字段二选一。                                            |
+| response_schema | object | 否    |                  | 指定响应的 `jsonschema` 对象,未指定 `response_example` 字段时生效。                        |
+| with_mock_header| boolean| 否    | true             | 当设置为 `true` 时,将添加响应头 `x-mock-by: APISIX/{version}`。设置为 `false` 时则不添加该响应头。   |
 
-支持的字段类型:`string`, `number`, `integer`, `boolean`, `object`, `array`
-基础数据类型(`string`,`number`,`integer`,`boolean`)可通过配置`example`属性指定生成的响应值,未配置时随机返回。
-以下是一个`jsonschema`实例:
+JSON schema 在其字段中支持以下类型:
+
+- `string`
+- `number`
+- `integer`
+- `boolean`
+- `object`
+- `array`
+
+以下是一个 JSON schema 示例:

Review Comment:
   ```suggestion
   以下是一个 JSON Schema 示例:
   ```



##########
docs/zh/latest/plugins/mocking.md:
##########
@@ -86,7 +99,7 @@ Mock API 插件,绑定该插件后将随机返回指定格式的`mock`数据
 }
 ```
 
-以下为该`jsonschema`可能生成的返回对象:
+以下为上述 JSON schema 可能生成的返回对象:

Review Comment:
   ```suggestion
   以下为上述 JSON Schema 可能生成的返回对象:
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #6891:
URL: https://github.com/apache/apisix/pull/6891#discussion_r854748626


##########
docs/zh/latest/plugins/fault-injection.md:
##########
@@ -23,23 +29,33 @@ title: fault-injection
 
 ## 描述
 
-故障注入插件,该插件可以和其他插件一起使用,并且会在其他插件前被执行,配置 `abort` 参数将直接返回给客户端指定的响应码并且终止其他插件的执行,配置 `delay` 参数将延迟某个请求,并且还会执行配置的其他插件。
+`fault-injection` 插件,该插件可以和其他插件一起使用,并且会在其他插件前被执行。
+
+`abort` 属性将直接返回给客户端指定的响应码并且终止其他插件的执行。
+
+`delay` 属性将延迟某个请求,并且还会执行配置的其他插件。
 
 ## 属性
 
-| 名称              | 类型    | 必选项 | 默认值 | 有效值     | 描述                       |
-| ----------------- | ------- | ------ | ------ | ---------- | -------------------------- |
-| abort.http_status | integer | 必需   |        | [200, ...] | 返回给客户端的 http 状态码 |
-| abort.body        | string  | 可选   |        |            | 返回给客户端的响应数据。支持使用 Nginx 变量,如 `client addr: $remote_addr\n`|
-| abort.percentage  | integer | 可选   |        | [0, 100]   | 将被中断的请求占比         |
-| abort.vars        | array[] | 可选   |        |            | 执行故障注入的规则,当规则匹配通过后才会执行故障注。`vars` 是一个表达式的列表,来自 [lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list)。 |
-| delay.duration    | number  | 必需   |        |            | 延迟时间,可以指定小数     |
-| delay.percentage  | integer | 可选   |        | [0, 100]   | 将被延迟的请求占比         |
-| delay.vars        | array[] | 可选   |        |            | 执行请求延迟的规则,当规则匹配通过后才会延迟请求。`vars` 是一个表达式列表,来自 [lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list)。   |
+| 名称              | 类型    | 必选项 | 有效值     | 描述                       |
+| ----------------- | ------- | ---- |  ---------- | -------------------------- |
+| abort.http_status | integer | 是   |  [200, ...] | 返回给客户端的 HTTP 状态码 |
+| abort.body        | string  | 否   |             | 返回给客户端的响应数据。支持使用 NGINX 变量,如 `client addr: $remote_addr\n`|
+| abort.percentage  | integer | 否   |  [0, 100]   | 将被中断的请求占比         |
+| abort.vars        | array[] | 否   |             | 执行故障注入的规则,当规则匹配通过后才会执行故障注。`vars` 是一个表达式的列表,来自 [lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list)。 |
+| delay.duration    | number  | 是   |             | 延迟时间,可以指定小数     |
+| delay.percentage  | integer | 否   |  [0, 100]   | 将被延迟的请求占比         |
+| delay.vars        | array[] | 否   |             | 执行请求延迟的规则,当规则匹配通过后才会延迟请求。`vars` 是一个表达式列表,来自 [lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list)。   |
+
+:::info IMPORTANT
+
+`abort` 和 `delay` 属性至少要配置一个。
 
-注:参数 abort 和 delay 至少要存在一个。
+:::
 
-`vars` 是由 `lua-resty-expr` 的表达式组成的列表,它可以灵活的实现规则之间的 `and/or` 关系,示例:
+:::tip
+
+`vars` 是由 [`lua-resty-expr`](https://github.com/api7/lua-resty-expr) 的表达式组成的列表,它可以灵活的实现规则之间的 AND/OR 关系,示例如下:

Review Comment:
   ```suggestion
   `vars` 是由 [`lua-resty-expr`](https://github.com/api7/lua-resty-expr) 的表达式组成的列表,它可以灵活地实现规则之间的 AND/OR 关系,示例如下:
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #6891:
URL: https://github.com/apache/apisix/pull/6891#discussion_r854750601


##########
docs/zh/latest/plugins/grpc-transcode.md:
##########
@@ -75,14 +100,15 @@ protoc --include_imports --descriptor_set_out=proto.pb proto/helloworld.proto
 
 然后我们可以将 `proto.pb` 的内容作为 proto 的 `content` 字段提交。

Review Comment:
   ```suggestion
   然后将 `proto.pb` 的内容作为 proto 的 `content` 字段提交。
   ```



##########
docs/zh/latest/plugins/grpc-transcode.md:
##########
@@ -75,14 +100,15 @@ protoc --include_imports --descriptor_set_out=proto.pb proto/helloworld.proto
 
 然后我们可以将 `proto.pb` 的内容作为 proto 的 `content` 字段提交。

Review Comment:
   ```suggestion
   然后将 `proto.pb` 的内容作为 proto 的 `content` 字段进行提交。
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #6891:
URL: https://github.com/apache/apisix/pull/6891#discussion_r854753309


##########
docs/zh/latest/plugins/mocking.md:
##########
@@ -23,22 +29,29 @@ title: mocking
 
 ## 描述
 
-Mock API 插件,绑定该插件后将随机返回指定格式的`mock`数据,不再转发到后端。
+`mocking` 插件用于 Mock API。当执行该插件时,它将随机返回指定格式的模拟数据,并且请求不会转发到上游。
 
 ## 属性
 
-| 名称            | 类型    | 必选项 | 默认值 | 有效值                                                            | 描述                                                                                                                                              |
-| -------------   | -------| ----- | ----- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
-| delay           | integer | 可选 |        |                                                                 | 延时返回的时间,单位为秒                                            |
-| response_status | integer| 可选  | 200 |                                                                 | 返回的响应 http status code                                            |
-| content_type    | string | 可选  | application/json |                                                                 | 返回的响应头的 Content-Type。                                            |
-| response_example| string | 可选  |        |                                                                 | 返回的响应体,与`response_schema`字段二选一                                            |
-| response_schema | object | 可选  |        |                                                                 | 指定响应的`jsonschema`对象,未指定`response_example`字段时生效,具体结构看后文说明                                            |
-| with_mock_header | boolean | 可选 | true  |                                                                 | 是否返回响应头:"x-mock-by: APISIX/{version}",默认返回,指定为 false 则不返回        |
+| 名称            | 类型    | 必选项 | 默认值           |  描述                                                           |
+| -------------   | -------| ----- | ---------------- | --------------------------------------------------------------------------- |
+| delay           | integer| 否    |                  | 延时返回的时间,单位为秒。                                            |
+| response_status | integer| 否    | 200              | 返回响应的 HTTP 状态码。                                            |
+| content_type    | string | 否    | application/json | 返回响应的 Header `Content-Type`。                                            |
+| response_example| string | 否    |                  | 返回响应的 Body,与 `response_schema` 字段二选一。                                            |
+| response_schema | object | 否    |                  | 指定响应的 `jsonschema` 对象,未指定 `response_example` 字段时生效。                        |
+| with_mock_header| boolean| 否    | true             | 当设置为 `true` 时,将添加响应头 `x-mock-by: APISIX/{version}`。设置为 `false` 时则不添加该响应头。   |
 
-支持的字段类型:`string`, `number`, `integer`, `boolean`, `object`, `array`
-基础数据类型(`string`,`number`,`integer`,`boolean`)可通过配置`example`属性指定生成的响应值,未配置时随机返回。
-以下是一个`jsonschema`实例:
+JSON schema 在其字段中支持以下类型:

Review Comment:
   ```suggestion
   JSON Schema 在其字段中支持以下类型:
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] juzhiyuan commented on a diff in pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on code in PR #6891:
URL: https://github.com/apache/apisix/pull/6891#discussion_r857443879


##########
docs/zh/latest/plugins/grpc-transcode.md:
##########
@@ -23,20 +29,40 @@ title: grpc-transcode
 
 ## 描述
 
-HTTP(s) -> APISIX -> gRPC server
+使用 `grpc-transcode` 插件可以在 HTTP 和 gRPC 请求之间进行转换。
 
-## Proto
+APISIX 接收 HTTP 请求后,首先对请求进行转码,并将转码后的请求转发到 gRPC 服务,获取响应并以 HTTP 格式将其返回给客户端。
 
-### 参数
+<!-- TODO: use an image here to explain the concept better -->

Review Comment:
   Do you have a specific image?



##########
docs/zh/latest/plugins/response-rewrite.md:
##########
@@ -23,39 +29,47 @@ title: response-rewrite
 
 ## 描述
 
-该插件支持修改上游服务或网关本身返回的 body 和 header 信息。
+`response-rewrite` 插件支持修改上游服务或 APISIX 返回的 Body 和 Header 信息。
 
-使用场景:
+该插件可以应用在以下场景中:
 
-1. 可以设置 `Access-Control-Allow-*` 等 header 信息,来实现 CORS(跨域资源共享)的功能。
+- 通过设置 `Access-Control-Allow-*` 字段实现 CORS(跨域资源共享)的功能。
+- 通过设置标头中的 `status_code` 和 `Location` 字段实现重定向。
 
-2. 另外也可以通过配置 status_code 和 header 里面的 Location 来实现重定向,当然如果只是需要重定向功能,最好使用 [redirect](redirect.md) 插件。
+:::tip
+
+如果你仅需要重定向功能,建议使用 [redirect](redirect.md) 插件。
+
+:::
 
 ## 属性
 
 | 名称              | 类型      | 必选项 | 默认值    | 有效值             | 描述                                                                                                                                                             |
 |-----------------|---------|-----|--------|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| status_code     | integer | 可选  |        | [200, 598]      | 修改上游返回状态码,默认保留原始响应代码。                                                                                                                                          |
-| body            | string  | 可选  |        |                 | 修改上游返回的 `body` 内容,如果设置了新内容,header 里面的 content-length 字段也会被去掉。                                                                                                  |
-| body_base64     | boolean | 可选  | false  |                 | 描述 `body` 字段是否需要 base64 解码之后再返回给客户端,用在某些图片和 Protobuffer 场景。                                                                                                    |
-| headers         | object  | 可选  |        |                 | 返回给客户端的 `headers`,这里可以设置多个。头信息如果存在将重写,不存在则添加。想要删除某个 header 的话,把对应的值设置为空字符串即可。这个值能够以 `$var` 的格式包含 Nginx 变量,比如 `$remote_addr $balancer_ip`。                      |
-| vars            | array[] | 可选  |        |                 | `vars` 是一个表达式列表,只有满足条件的请求和响应才会修改 body 和 header 信息,来自 [lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list)。如果 `vars` 字段为空,那么所有的重写动作都会被无条件的执行。 |
-| filters         | array[] | 可选  |        |                 | 一组过滤器,采用指定字符串表达式修改响应体。                                                                                                                                         |
-| filters.regex   | string  | 必选  |        |                 | 用于匹配响应体正则表达式。                                                                                                                                                  |
-| filters.scope   | string  | 可选  | "once" | "once","global" | 替换范围,"once" 表达式 `filters.regex` 仅替换首次匹配上响应体的内容,"global" 则进行全局替换。                                                                                               |
-| filters.replace | string  | 必选  |        |                 | 替换后的内容。                                                                                                                                                        |
-| filters.options | string  | 可选  | "jo"   |                 | 正则匹配有效参数,可选项见 [ngx.re.match](https://github.com/openresty/lua-nginx-module#ngxrematch)。                                                                        |
+| status_code     | integer | 否  |        | [200, 598]      | 修改上游返回状态码,默认保留原始响应代码。                                                                                                                                          |
+| body            | string  | 否  |        |                 | 修改上游返回的 `body` 内容,如果设置了新内容,header 里面的 content-length 字段也会被去掉。                                                                                                  |
+| body_base64     | boolean | 否  | false  |                 | 描述 `body` 字段是否需要 base64 解码之后再返回给客户端,用在某些图片和 Protobuffer 场景。                                                                                                    |
+| headers         | object  | 否  |        |                 | 返回给客户端的 `headers`,这里可以设置多个。头信息如果存在将重写,不存在则添加。想要删除某个 header 的话,把对应的值设置为空字符串即可。这个值能够以 `$var` 的格式包含 NGINX 变量,比如 `$remote_addr $balancer_ip`。                      |
+| vars            | array[] | 否  |        |                 | `vars` 是一个表达式列表,只有满足条件的请求和响应才会修改 body 和 header 信息,来自 [lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list)。如果 `vars` 字段为空,那么所有的重写动作都会被无条件的执行。 |
+| filters         | array[] | 否  |        |                 | 一组过滤器,采用指定字符串表达式修改响应体。                                                                                                                                         |
+| filters.regex   | string  | 是  |        |                 | 用于匹配响应体正则表达式。                                                                                                               |
+| filters.scope   | string  | 否  | "once" | "once","global" | 替换范围,"once" 表达式 `filters.regex` 仅替换首次匹配上响应体的内容,"global" 则进行全局替换。                                                                                               |
+| filters.replace | string  | 是  |        |                 | 替换后的内容。                                                                                                                                                        |
+| filters.options | string  | 否  | "jo"   |                 | 正则匹配有效参数,可选项见 [ngx.re.match](https://github.com/openresty/lua-nginx-module#ngxrematch)。                                                                                                           |
 
-`body` 和 `filters`,两个只能配置其中一个。
+:::note
 
-## 示例
+`body` 和 `filters`属性只能配置其中一个。

Review Comment:
   ```suggestion
   `body` 和 `filters` 属性只能配置其中一个。
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] spacewander merged pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
spacewander merged PR #6891:
URL: https://github.com/apache/apisix/pull/6891


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #6891:
URL: https://github.com/apache/apisix/pull/6891#discussion_r854750272


##########
docs/zh/latest/plugins/grpc-transcode.md:
##########
@@ -23,20 +29,40 @@ title: grpc-transcode
 
 ## 描述
 
-HTTP(s) -> APISIX -> gRPC server
+`grpc-transcode` 插件可以在 HTTP 和 gRPC 请求之间进行转换。
 
-## Proto
+APISIX 接收 HTTP 请求后,首先对请求进行转码,并将转码后的请求转发到 gRPC 服务,获取响应并以 HTTP 格式将其返回给客户端。
 
-### 参数
+<!-- TODO: use an image here to explain the concept better -->

Review Comment:
   you can use picture in this post:https://apisix.apache.org/zh/blog/2022/01/25/apisix-grpc-web-integration



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #6891:
URL: https://github.com/apache/apisix/pull/6891#discussion_r854749272


##########
docs/zh/latest/plugins/fault-injection.md:
##########
@@ -298,99 +159,65 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
-测试:
+## 测试插件
 
-1、abort 和 delay 的 vars 规则匹配失败:
+通过上述示例启用插件后,可以向路由发起请求:

Review Comment:
   ```suggestion
   通过上述示例启用插件后,可以向路由发起如下请求:
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #6891:
URL: https://github.com/apache/apisix/pull/6891#discussion_r854754931


##########
docs/zh/latest/plugins/response-rewrite.md:
##########
@@ -103,12 +119,23 @@ X-Server-balancer_addr: 127.0.0.1:80
 {"code":"ok","message":"new json body"}
 ```
 
-### 禁用插件
+:::info IMPORTANT
+
+[ngx.exit](https://openresty-reference.readthedocs.io/en/latest/Lua_Nginx_API/#ngxexit) 将会中断当前请求的执行并将其状态码返回给 NGINX。
+
+如果你在 `access` 阶段执行 `ngx.exit`,只是中断了请求处理阶段,响应阶段仍然会处理。比如,如果你配置了 `response-rewrite` 插件,它会强制覆盖你的响应信息(如响应代码)。

Review Comment:
   ```suggestion
   如果你在 `access` 阶段执行 `ngx.exit`,只是中断了请求处理阶段,响应阶段仍然会处理。如果你配置了 `response-rewrite` 插件,它会强制覆盖你的响应信息(如响应代码)。
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #6891:
URL: https://github.com/apache/apisix/pull/6891#discussion_r854752593


##########
docs/zh/latest/plugins/grpc-web.md:
##########
@@ -50,19 +53,35 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 }'
 ```
 
+:::info IMPORTANT
+
+在使用 `gRPC Web` 代理插件时,路由必须使用**前缀匹配**模式(例如:`/*` 或 `/grpc/example/*`),因为 `gRPC Web` 客户端会在 URI 中传递 `proto` 中声明的**包名称**、**服务接口名称**、**方法名称**等信息(例如:`/path/a6.RouteService/Insert`),
+
+因此在使用**绝对匹配**时将无法命中插件和提取 `proto` 信息。

Review Comment:
   ```suggestion
   在使用 `gRPC Web` 代理插件时,路由必须使用**前缀匹配**模式(例如:`/*` 或 `/grpc/example/*`),因为 `gRPC Web` 客户端会在 URI 中传递 `proto` 中声明的**包名称**、**服务接口名称**、**方法名称**等信息(例如:`/path/a6.RouteService/Insert`),因此在使用**绝对匹配**时将无法命中插件和提取 `proto` 信息。
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #6891:
URL: https://github.com/apache/apisix/pull/6891#discussion_r854754400


##########
docs/zh/latest/plugins/proxy-rewrite.md:
##########
@@ -23,25 +29,26 @@ title: proxy-rewrite
 
 ## 描述
 
-proxy-rewrite 是上游代理信息重写插件,支持对 `scheme`、`uri`、`host` 等信息的重写。
+`proxy-rewrite` 是上游代理信息重写插件,支持对 `scheme`、`uri`、`host` 等信息的重写。

Review Comment:
   ```suggestion
   `proxy-rewrite` 是处理上游代理信息重写的插件,支持对 `scheme`、`uri`、`host` 等信息进行重写。
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] hf400159 commented on a diff in pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
hf400159 commented on code in PR #6891:
URL: https://github.com/apache/apisix/pull/6891#discussion_r857779535


##########
docs/zh/latest/plugins/grpc-transcode.md:
##########
@@ -23,20 +29,40 @@ title: grpc-transcode
 
 ## 描述
 
-HTTP(s) -> APISIX -> gRPC server
+使用 `grpc-transcode` 插件可以在 HTTP 和 gRPC 请求之间进行转换。
 
-## Proto
+APISIX 接收 HTTP 请求后,首先对请求进行转码,并将转码后的请求转发到 gRPC 服务,获取响应并以 HTTP 格式将其返回给客户端。
 
-### 参数
+<!-- TODO: use an image here to explain the concept better -->

Review Comment:
   No, I have no idea. but I'll do it later.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #6891:
URL: https://github.com/apache/apisix/pull/6891#discussion_r854747700


##########
docs/zh/latest/plugins/fault-injection.md:
##########
@@ -23,23 +29,33 @@ title: fault-injection
 
 ## 描述
 
-故障注入插件,该插件可以和其他插件一起使用,并且会在其他插件前被执行,配置 `abort` 参数将直接返回给客户端指定的响应码并且终止其他插件的执行,配置 `delay` 参数将延迟某个请求,并且还会执行配置的其他插件。
+`fault-injection` 插件,该插件可以和其他插件一起使用,并且会在其他插件前被执行。

Review Comment:
   ```suggestion
   `fault-injection` 为故障注入插件,该插件可以和其他插件一起使用,并在其他插件前被执行。
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #6891: docs: update "Transformation" Plugins

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #6891:
URL: https://github.com/apache/apisix/pull/6891#discussion_r854750272


##########
docs/zh/latest/plugins/grpc-transcode.md:
##########
@@ -23,20 +29,40 @@ title: grpc-transcode
 
 ## 描述
 
-HTTP(s) -> APISIX -> gRPC server
+`grpc-transcode` 插件可以在 HTTP 和 gRPC 请求之间进行转换。
 
-## Proto
+APISIX 接收 HTTP 请求后,首先对请求进行转码,并将转码后的请求转发到 gRPC 服务,获取响应并以 HTTP 格式将其返回给客户端。
 
-### 参数
+<!-- TODO: use an image here to explain the concept better -->

Review Comment:
   you can use picture in this post:https://apisix.apache.org/zh/blog/2022/01/25/apisix-grpc-web-integration



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org