100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
HttpClientProtocol improvement (prevent setting request body when using GET method)
Rich Turnerb7feb29ef406
diff --git a/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientProtocol.javaindex b4aaa5236..7e19f372a 100644--- a/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientProtocol.java@@ -191,7 +191,7 @@ public class HttpClientProtocol extends AbstractProtocol {this.client = client;this.path = path;- this.method = method;+ this.method = method != null ? method : HttpMethod.GET;this.headers = headers;this.queryParameters = queryParameters;this.failureCodes = failureCodes;@@ -254,10 +254,10 @@ public class HttpClientProtocol extends AbstractProtocol {requestBuilder.property(QueryParameterInjectorFilter.DYNAMIC_VALUE, value);}- if (value == null) {- invocation = requestBuilder.build(method);- } else {+ if (method != null && !HttpMethod.GET.equals(method) && value != null) {invocation = requestBuilder.build(method, Entity.entity(value, contentType));+ } else {+ invocation = requestBuilder.build(method);}return invocation;