you can refer to the response rewrite plugin[1]. [1] https://github.com/apache/incubator-apisix/blob/master/doc/plugins/response-rewrite.md
Thanks, Ming Wen, Apache APISIX & Apache SkyWalking Twitter: _WenMing jie123108 <[email protected]> 于2020年4月23日周四 下午3:38写道: > >```` > >{error_msg: 'error message’} > >```` > > >I think this style should be enough. >The `code` is meaningless, I do > not like it. >The `code` is meaningless too. >most of case: >{ok = true} > >{ok = false, error_msg = "xxxx"} >so we can drop `ok`, it is meaningless. > > What I'm trying to say is that if the business system is developed and > online. The data format it defines is > ``` > {ok:false, errmsg:'error message'} > ``` > And the client also does this logically. > Thus, after using apisix processing, some error scenarios return > ``` > {error_msg: 'error message’} > ``` > > > For the client, this is the wrong message format. The client expects it to > be in the format given above. > Shouldn't the gateway be able to adapt to different message formats? > > > My example is json. What if the business system is not using json? > For example, if you use msgpack format, then you can easily adapt the > message to msgpack format with response_format.
