Payload is empty when making HTTP POST request with HttpConnector

I am trying to make a HTTP request with Camunda’s HTTP Connector, but payload is not sent. When I am using OkHttp framework for the same request, payload is delivered. What could be the issue in case of HTTP Connector?

The method’s I am using are following:

  public void postExampleWithHttpConnector() {
	  HttpConnector http = Connectors.getConnector(HttpConnector.ID);

	  HttpResponse response = http.createRequest()
	  .post()
	  .contentType("application/json")
	  .payload("{\"jsonrpc\":\"2.0\",\"method\":\"changeDetail\"}")
	  .url("http://posttestserver.com/post.php")
	  .execute();
	  		  
	  System.out.println(response.getResponse());
	  
	  response.close();		  
  }

public void postExampleWithOkHttpClient() {
	OkHttpClient client = new OkHttpClient();

	MediaType mediaType = MediaType.parse("application/json");
	RequestBody body = RequestBody.create(mediaType, "{\"jsonrpc\":\"2.0\",\"method\":\"changeDetail\"}");
	Request request = new Request.Builder()
	  .url("http://posttestserver.com/post.php")
	  .post(body)
	  .addHeader("content-type", "application/json")
	  .build();

	try {
	Response response = client.newCall(request).execute();
	System.out.println(response.body().string());
	response.close();
	} catch (Exception exception) {
		System.out.println(exception.getMessage());
	}
}

Hi,

the body sent by the Camunda Connect code is not empty. But the service you use does not record the body. I assume this is caused by the fact that the Camunda Connect request uses the Transfer-Encoding: chunked. This means the body is transferred as chunks and the content length is not set in the request header. Probably your test service only records bodies with a known content length.

Cheers,
Sebastian