Skip to content

Commit

Permalink
Use applyContentParser for request body parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmitterdorfer committed Nov 29, 2022
1 parent b86f885 commit 62b9fc8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ public QueryBuilder getQuery() {
}

public void parseXContent(XContentParser parser) throws IOException {
if (parser == null) {
return;
}
XContentParser.Token token = parser.currentToken();
String currentFieldName = null;
if (token != XContentParser.Token.START_OBJECT && (token = parser.nextToken()) != XContentParser.Token.START_OBJECT) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public List<Route> routes() {
@Override
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
GetProfilingRequest getProfilingRequest = new GetProfilingRequest();
request.withContentOrSourceParamParserOrNull(getProfilingRequest::parseXContent);
request.applyContentParser(getProfilingRequest::parseXContent);

return channel -> {
RestStatusToXContentListener<GetProfilingResponse> listener = new RestStatusToXContentListener<>(channel);
Expand Down

0 comments on commit 62b9fc8

Please sign in to comment.