SO, i couldn't figure out how to exclude post data from jmeter slave-to-master communication; I had to write own JSR-223 Sampler which does the http request called form Java code using HttpConnection class and then manipulates the sample data from Java code. Http Sampler didn't worked for me.
such kind of sampler are good because it also allows to read files and send them to http post body using Input/OutputStreams and buffers, thus we no longer require memory for the whole file to be uploaded that HttpSampler uses to allocate.
Example sampler code is:
import java.net.HttpURLConnection;
HttpURLConnection httpConn = null;
String line = null;
try {
URL url = new URL("http://${url}/api/v2.0/datasets");
URLConnection urlConn = url.openConnection();
if (!(urlConn instanceof HttpURLConnection)) {
throw new IOException ("URL is not an Https URL");
}
httpConn = (HttpURLConnection)urlConn;
httpConn.setAllowUserInteraction(false);
httpConn.setInstanceFollowRedirects(true);
httpConn.setRequestMethod("POST");
httpConn.setRequestProperty("Connection", "keep-alive");
httpConn.setRequestProperty("Content-Type", "multipart/form-data; boundary=boundary");
httpConn.setRequestProperty("User-Agent", "Apache-HttpClient/4.5.5 (Java/1.8.0_161)");
httpConn.setReadTimeout(500 * 1000);
httpConn.setDoOutput(true);
OutputStreamWriter out = new OutputStreamWriter(
httpConn.getOutputStream());
out.write("--boundary\r\n");
out.write("Content-Disposition: form-data; name=\"name\"\r\n");
out.write("Content-Type: text/plain; charset=US-ASCII\r\n");
out.write("Content-Transfer-Encoding: 8bit\r\n");
out.write("\r\n");
out.write("dataset${__time}\r\n");
out.write("--boundary\r\n");
out.write("Content-Disposition: form-data; name=\"token\"\r\n");
out.write("Content-Type: text/plain; charset=US-ASCII\r\n");
out.write("Content-Transfer-Encoding: 8bit\r\n");
out.write("\r\n");
out.write("${user_token}\r\n");
out.write("--boundary\r\n");
out.write("Content-Disposition: form-data; name=\"sep\"\r\n");
out.write("Content-Type: text/plain; charset=US-ASCII\r\n");
out.write("Content-Transfer-Encoding: 8bit\r\n");
out.write("\r\n");
out.write("${separator}\r\n");
out.write("--boundary\r\n");
out.write("Content-Disposition: form-data; name=\"csv_file\"; filename=\"filename.csv\"\r\n");
out.write("Content-Type: text/plain\r\n");
out.write("Content-Transfer-Encoding: binary\r\n");
out.write("\r\n");
out.write("\r\n");
String filepath="files//${datasetFileName}";
File file = new File(filepath);
FileInputStream fileInputStream = new FileInputStream(file);
InputStreamReader isr = new InputStreamReader(fileInputStream);
BufferedReader fin =
new BufferedReader(isr);
String bufString;
while ((bufString = fin.readLine()) != null) {
out.write(bufString+"r\n");
}
out.write("--boundary--");
out.flush();
out.close();
InputStream _is;
log.info(""+httpConn.getResponseCode());
SampleResult.setResponseCode(httpConn.getResponseCode()+"");
if (httpConn.getResponseCode() >= 400) {
_is = httpConn.getErrorStream();
SampleResult.setSuccessful(false);
} else {
/* error from server */
_is = httpConn.getInputStream();
}
if (_is!=null)
{
BufferedReader in =
new BufferedReader(
new InputStreamReader(_is)
);
String decodedString;
String accumulate="";
while ((decodedString = in.readLine()) != null) {
accumulate=accumulate+"\n"+decodedString;
log.info(decodedString);
}
SampleResult.setResponseData(accumulate);
}
else
{
SampleResult.setResponseData("No data from server");
}
}
catch (MalformedURLException e) {
e.printStackTrace();
log.info(e.getMessage());
} catch( SocketTimeoutException e){
e.printStackTrace();
log.info(e.getMessage());
}
finally {//httpConn.disconnect();
}