MXS-1220: Pretty-print by default

The REST API now pretty-prints by default. This is done to make it easier
to use the API with browsers that don't have an integrated REST API
client.
This commit is contained in:
Markus Mäkelä 2017-05-29 10:43:14 +03:00
parent 88bf361e61
commit 4c2560b5a6

View File

@ -121,7 +121,14 @@ int Client::process(string url, string method, const char* upload_data, size_t *
if (js)
{
int flags = request.get_option("pretty") == "true" ? JSON_INDENT(4) : 0;
int flags = 0;
string pretty = request.get_option("pretty");
if (pretty == "true" || pretty.length() == 0)
{
flags |= JSON_INDENT(4);
}
data = mxs::json_dump(js, flags);
}