We are using JAVA implementation for one of the requests.In the request we are uploading a file. Request doesn't work when HTTPCLIENT4 implementation is selected.The request works fine with previous Jmeter version with HTTPCLIENT3.1 implementation. We need to capture bytes sent in results. How to capture bytes sent through JAVA implementation in HTTP Request sampler
0
votes
1 Answers
0
votes
Sent bytes is basically a combination of URL + headers + body so you can calculate it yourself using JSR223 PostProcessor and code like:
def url = sampler.getUrl().toString().length()
def headers = prev.getHeadersSize()
def body = 0;
sampler.getHTTPFiles().each {file ->
body += new File(file.getPath()).length()
}
prev.setSentBytes(url + headers + body)
Where:
sampleris an instance of HTTPSamplerProxy where you can get all files which you're sending with the requestprevis an instance of HTTPSampleResult where you can get URL and Headers and also overrideSent Bytesfield.
See The Groovy Templates Cheat Sheet for JMeter to see what else you can do with Groovy and how.
Content-Lengthfield. That field will tell you the size of the sent content, excluding headers. You can do it using JSR223 PostProcessor - Kiril S.