[TEST] Remove content type auto-detection while parsing request body in REST tests

This commit is contained in:
javanna 2017-02-11 08:28:56 +01:00 committed by Luca Cavanna
parent b8e2d12b23
commit 04aaedc083
1 changed files with 2 additions and 5 deletions

View File

@ -24,10 +24,9 @@ import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentLocation;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.common.xcontent.json.JsonXContent;
import org.elasticsearch.test.rest.yaml.ClientYamlTestExecutionContext;
import org.elasticsearch.test.rest.yaml.ClientYamlTestResponse;
import org.elasticsearch.test.rest.yaml.ClientYamlTestResponseException;
@ -118,9 +117,7 @@ public class DoSection implements ExecutableSection {
} else if (token.isValue()) {
if ("body".equals(paramName)) {
String body = parser.text();
XContentType bodyContentType = XContentFactory.xContentType(body);
XContentParser bodyParser = XContentFactory.xContent(bodyContentType).createParser(
NamedXContentRegistry.EMPTY, body);
XContentParser bodyParser = JsonXContent.jsonXContent.createParser(NamedXContentRegistry.EMPTY, body);
//multiple bodies are supported e.g. in case of bulk provided as a whole string
while(bodyParser.nextToken() != null) {
apiCallSection.addBody(bodyParser.mapOrdered());