From 5ec5cd89d5e3f1d3db1c936f91f75bed30b2b786 Mon Sep 17 00:00:00 2001 From: Sylvain Wallez Date: Tue, 12 Jul 2022 11:59:33 +0200 Subject: [PATCH] boolean endpoints can have a request body --- .../transport/endpoints/BooleanEndpoint.java | 4 +-- .../endpoints/BooleanEndpointTest.java | 34 +++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 java-client/src/test/java/co/elastic/clients/transport/endpoints/BooleanEndpointTest.java diff --git a/java-client/src/main/java/co/elastic/clients/transport/endpoints/BooleanEndpoint.java b/java-client/src/main/java/co/elastic/clients/transport/endpoints/BooleanEndpoint.java index 9c2e32439..9ffdc9f9a 100644 --- a/java-client/src/main/java/co/elastic/clients/transport/endpoints/BooleanEndpoint.java +++ b/java-client/src/main/java/co/elastic/clients/transport/endpoints/BooleanEndpoint.java @@ -33,10 +33,10 @@ public BooleanEndpoint( Function> queryParameters, Function> headers, - boolean hasRequestBody, // always false + boolean hasRequestBody, JsonpDeserializer responseParser // always null ) { - super(id, method, requestUrl, queryParameters, headers, false, null); + super(id, method, requestUrl, queryParameters, headers, hasRequestBody, null); } @Override diff --git a/java-client/src/test/java/co/elastic/clients/transport/endpoints/BooleanEndpointTest.java b/java-client/src/test/java/co/elastic/clients/transport/endpoints/BooleanEndpointTest.java new file mode 100644 index 000000000..769195044 --- /dev/null +++ b/java-client/src/test/java/co/elastic/clients/transport/endpoints/BooleanEndpointTest.java @@ -0,0 +1,34 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.transport.endpoints; + +import co.elastic.clients.elasticsearch.core.ExistsRequest; +import co.elastic.clients.elasticsearch.logstash.PutPipelineRequest; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class BooleanEndpointTest extends Assertions { + + @Test + public void testHasRequestBody() { + assertFalse(ExistsRequest._ENDPOINT.hasRequestBody()); + assertTrue(PutPipelineRequest._ENDPOINT.hasRequestBody()); + } +}