For different API business systems, the format of the returned json may be different, for example, in one system, the structure of the returned message is this: ```` {ok: true|false, code: 'error code', data: {}} ```` Or it could be: ```` {status: 0, errmsg: 'error message', result: {} ````
One problem with using apisix is that apisix returns an error message like this: ```` {error_msg: 'error message'} ```` In some of the plugins, the return is this: ```` {message: 'error message'} ```` Such an inconsistent return format can cause a lot of trouble for client development. Shouldn't the apisix core library provide a uniform formatting function so that users can customize the return values. In the example above, the user can customize it in this way: ```` function response_format(resp) const json_response = { ok = resp.error_msg == "", code = resp.error_msg, data = resp, } return json_response end ```` This way, the error messages returned by the apisix system, become consistent with the business system. The client will only need to handle one message format. Another problem to consider is that if we use apisix to handle html static website, the current system error return is also json, for the end user to return a json directly, is not very friendly? Then we have a unified formatting method, is it possible to consider the case of formatting to html. jie123...@163.com