You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by me...@apache.org on 2020/06/18 01:25:03 UTC

[incubator-apisix] branch master updated: doc: update echo-cn.md (#1726)

This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 3afcf54  doc: update echo-cn.md (#1726)
3afcf54 is described below

commit 3afcf54fe4daec9a4aa2402ab65598313fe5c4ef
Author: agile6v <ag...@gmail.com>
AuthorDate: Thu Jun 18 09:24:55 2020 +0800

    doc: update echo-cn.md (#1726)
---
 doc/plugins/echo-cn.md | 36 +++++++++++++++---------------------
 1 file changed, 15 insertions(+), 21 deletions(-)

diff --git a/doc/plugins/echo-cn.md b/doc/plugins/echo-cn.md
index 61e5b4d..71122fb 100644
--- a/doc/plugins/echo-cn.md
+++ b/doc/plugins/echo-cn.md
@@ -26,42 +26,36 @@
 
 ## 简介
 
-echo是一个有用的插件,可帮助用户尽可能全面地了解如何开发APISIX插件。
+echo 是一个有用的插件,可帮助用户尽可能全面地了解如何开发APISIX插件。
 
 
-该插件解决了常见阶段中的相应功能,例如初始化,重写,访问,平衡器
-,标题文件管理器,正文过滤器和日志。
+该插件展示了如何在常见的 phase 中实现相应的功能,常见的 phase 有:init, rewrite, access, balancer, header filer, body filter 以及 log。
 
 ## 属性
 
 |属性名称          |必选项  |描述|
 |---------     |--------|-----------|
-| before_body |可选| 主体在过滤阶段之前。。|
-| body |可选| 身体替代上游反应。|
-| after_body |可选| 车身经过改装后的滤光相。|
+| before_body |可选| 在 body 属性之前添加的内容,如果 body 属性没有指定将添加在 upstream response body 之前。 |
+| body |可选| 返回给客户端的响应内容,它将覆盖 upstream 返回的响应 body。 |
+| after_body |可选| 在 body 属性之后添加的内容,如果 body 属性没有指定将在 upstream 响应 body 之后添加。 |
 
 ## 如何启用
 
 1. 为特定路由启用 echo 插件。
 
 ```shell
-curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
 {
     "plugins": {
-       "kafka-logger": {
-           "broker_list" :
-             {
-               "127.0.0.1":9092
-             },
-           "kafka_topic" : "test2",
-           "key" : "key1"
-       }
+        "echo": {
+            "before_body": "before the body modification "
+        }
     },
     "upstream": {
-       "nodes": {
-           "127.0.0.1:1980": 1
-       },
-       "type": "roundrobin"
+        "nodes": {
+            "127.0.0.1:1980": 1
+        },
+        "type": "roundrobin"
     },
     "uri": "/hello"
 }'
@@ -75,7 +69,7 @@ curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 'X-API-KEY: edd1c9f034335f13
 $ curl -i http://127.0.0.1:9080/hello
 HTTP/1.1 200 OK
 ...
-hello, world
+before the body modification hello world
 ```
 
 ## 禁用插件
@@ -83,7 +77,7 @@ hello, world
 当您要禁用`echo`插件时,这很简单,您可以在插件配置中删除相应的json配置,无需重新启动服务,它将立即生效:
 
 ```shell
-$ curl http://127.0.0.1:2379/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d value='
+$ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d value='
 {
     "methods": ["GET"],
     "uri": "/hello",