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":&nbsp;[{"body":&nbsp;"{\"code\":\"ok\",\"message\":\"new json body\"}",
"headers":&nbsp;{"X-Server-id":&nbsp;3,
"X-Server-status":&nbsp;"on",
"X-Server-balancer_addr":&nbsp;"$balancer_ip:$balancer_port"

},
"vars":&nbsp;[["status",
"==",
"200"

]

]

},
{"body":&nbsp;"{\"code\":\"error\",\"message\":\"request limit\"}",
"headers":&nbsp;{"X-Server-id":&nbsp;3,
"X-Server-status":&nbsp;"on",
"X-Server-balancer_addr":&nbsp;"$balancer_ip:$balancer_port"

},
"vars":&nbsp;[["status",
"==",
"502"

]

]

}

]
&nbsp;

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":&nbsp;[{"body":&nbsp;"{\"code\":\"ok\",\"message\":\"new
> json body\"}",
> "headers":&nbsp;{"X-Server-id":&nbsp;3,
> "X-Server-status":&nbsp;"on",
> "X-Server-balancer_addr":&nbsp;"$balancer_ip:$balancer_port"
>
> },
> "vars":&nbsp;[["status",
> "==",
> "200"
>
> ]
>
> ]
>
> },
> {"body":&nbsp;"{\"code\":\"error\",\"message\":\"request limit\"}",
> "headers":&nbsp;{"X-Server-id":&nbsp;3,
> "X-Server-status":&nbsp;"on",
> "X-Server-balancer_addr":&nbsp;"$balancer_ip:$balancer_port"
>
> },
> "vars":&nbsp;[["status",
> "==",
> "502"
>
> ]
>
> ]
>
> }
>
> ]
> &nbsp;