Handle pretty=false and missing line feed for pretty=true which is the default for main REST action

This commit is contained in:
Benjamin Devèze 2013-11-17 22:09:53 +01:00 committed by Lee Hinman
parent 59f1ce5ada
commit 00be285c26
1 changed files with 4 additions and 1 deletions

View File

@ -54,6 +54,9 @@ public class RestMainAction extends BaseRestHandler {
@Override @Override
public void handleRequest(final RestRequest request, final RestChannel channel) { public void handleRequest(final RestRequest request, final RestChannel channel) {
if (!request.hasParam("pretty")) {
request.params().put("pretty", "true");
}
ClusterStateRequest clusterStateRequest = new ClusterStateRequest(); ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
clusterStateRequest.listenerThreaded(false); clusterStateRequest.listenerThreaded(false);
clusterStateRequest.masterNodeTimeout(TimeValue.timeValueMillis(0)); clusterStateRequest.masterNodeTimeout(TimeValue.timeValueMillis(0));
@ -72,7 +75,7 @@ public class RestMainAction extends BaseRestHandler {
} }
try { try {
XContentBuilder builder = RestXContentBuilder.restContentBuilder(request).prettyPrint(); XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
builder.startObject(); builder.startObject();
builder.field("ok", true); builder.field("ok", true);
builder.field("status", status.getStatus()); builder.field("status", status.getStatus());