You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have implemented many HTTP APIs so far, some of the codes repeat each time a new API is added.
argument validation. For example, /meta/app?name=<app_name> requires "name" to be provided, if not, it replies with "bad_request". This case is general. We can eliminate the following codes by filtering illegal requests in http_service::call before the handler.
Thrift-struct conversion to human-readable JSON. Currently table_printer is the general-used utility for this purpose. However table_printer is designed to support both "table" and "JSON" format, for JSON format, we should use a dedicated JSON library, like rapidjson, and nlohmann/json.
redirect_if_not_primary. We add primary-meta-check in every handler. We can eliminate them by prepending this call before meta_http_service::call.
voidmeta_http_service::get_app_envs_handler(const http_request &req, http_response &resp)
{
if (!redirect_if_not_primary(req, resp))
return;
The text was updated successfully, but these errors were encountered:
We have implemented many HTTP APIs so far, some of the codes repeat each time a new API is added.
/meta/app?name=<app_name>
requires "name" to be provided, if not, it replies with "bad_request". This case is general. We can eliminate the following codes by filtering illegal requests inhttp_service::call
before the handler.Thrift-struct conversion to human-readable JSON. Currently
table_printer
is the general-used utility for this purpose. Howevertable_printer
is designed to support both "table" and "JSON" format, for JSON format, we should use a dedicated JSON library, like rapidjson, and nlohmann/json.redirect_if_not_primary
. We add primary-meta-check in every handler. We can eliminate them by prepending this call beforemeta_http_service::call
.The text was updated successfully, but these errors were encountered: