Skip to content

Commit 4c2e1a8

Browse files
Fix boolean endpoints so they can have a request body (#341) (#342)
Co-authored-by: Sylvain Wallez <[email protected]>
1 parent e1f5701 commit 4c2e1a8

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

java-client/src/main/java/co/elastic/clients/transport/endpoints/BooleanEndpoint.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ public BooleanEndpoint(
3333
Function<RequestT,
3434
Map<String, String>> queryParameters,
3535
Function<RequestT, Map<String, String>> headers,
36-
boolean hasRequestBody, // always false
36+
boolean hasRequestBody,
3737
JsonpDeserializer<?> responseParser // always null
3838
) {
39-
super(id, method, requestUrl, queryParameters, headers, false, null);
39+
super(id, method, requestUrl, queryParameters, headers, hasRequestBody, null);
4040
}
4141

4242
@Override
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package co.elastic.clients.transport.endpoints;
21+
22+
import co.elastic.clients.elasticsearch.core.ExistsRequest;
23+
import co.elastic.clients.elasticsearch.logstash.PutPipelineRequest;
24+
import org.junit.jupiter.api.Assertions;
25+
import org.junit.jupiter.api.Test;
26+
27+
public class BooleanEndpointTest extends Assertions {
28+
29+
@Test
30+
public void testHasRequestBody() {
31+
assertFalse(ExistsRequest._ENDPOINT.hasRequestBody());
32+
assertTrue(PutPipelineRequest._ENDPOINT.hasRequestBody());
33+
}
34+
}

0 commit comments

Comments
 (0)