You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apisix.apache.org by 韩冬冬 <59...@qq.com.INVALID> on 2021/08/10 10:46:58 UTC
suggest for api-six response-writer plugin
when use apisix response-writer plugin,i find some problem like this: when use mutiply plugin,the message/code response from apisix will not very friendly when i want to modify this content,so why not to supply jsonArray to this plugin,something like this:
"response-rewrite": [{"body": "{\"code\":\"ok\",\"message\":\"new json body\"}",
"headers": {"X-Server-id": 3,
"X-Server-status": "on",
"X-Server-balancer_addr": "$balancer_ip:$balancer_port"
},
"vars": [["status",
"==",
"200"
]
]
},
{"body": "{\"code\":\"error\",\"message\":\"request limit\"}",
"headers": {"X-Server-id": 3,
"X-Server-status": "on",
"X-Server-balancer_addr": "$balancer_ip:$balancer_port"
},
"vars": [["status",
"==",
"502"
]
]
}
]
Re: suggest for api-six response-writer plugin
Posted by Ming Wen <we...@apache.org>.
There are a lot of garbled characters in the email, it is recommended that
you use text mode
Thanks,
Ming Wen, Apache APISIX PMC Chair
Twitter: _WenMing
韩冬冬 <59...@qq.com.invalid> 于2021年8月11日周三 上午9:55写道:
> when use apisix response-writer plugin,i find some problem like this: when
> use mutiply plugin,the message/code response from apisix will not very
> friendly when i want to modify this content,so why not to supply jsonArray
> to this plugin,something like this:
>
>
> "response-rewrite": [{"body": "{\"code\":\"ok\",\"message\":\"new
> json body\"}",
> "headers": {"X-Server-id": 3,
> "X-Server-status": "on",
> "X-Server-balancer_addr": "$balancer_ip:$balancer_port"
>
> },
> "vars": [["status",
> "==",
> "200"
>
> ]
>
> ]
>
> },
> {"body": "{\"code\":\"error\",\"message\":\"request limit\"}",
> "headers": {"X-Server-id": 3,
> "X-Server-status": "on",
> "X-Server-balancer_addr": "$balancer_ip:$balancer_port"
>
> },
> "vars": [["status",
> "==",
> "502"
>
> ]
>
> ]
>
> }
>
> ]
>