Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print or get the HTTP POST request body in JMETER

Tags:

jmeter

How to print or get the HTTP POST request body in JMETER

UseCase: I am running Jmeter from command line to generate Dashboard. For failed cases I need to capture Request Body.

like image 697
Sagar Varule Avatar asked Nov 02 '25 08:11

Sagar Varule


1 Answers

One of the options would be using JSR223 PostProcessor and the following code:

log.info(sampler.getMethod() + ' ' + sampler.getUrl().toString())

sampler.getArguments().each {arg ->
    log.info(arg.getStringValue())
}

It will print request method, URL and all the parameters along with values to jmeter.log file:

JMeter Print Request Details

in case of HTTP Request sampler stands for HTTPSampleProxy, see the JavaDoc for available methods and fields and Apache Groovy - Why and How You Should Use It article to learn more about Groovy scripting in JMeter

like image 89
Dmitri T Avatar answered Nov 04 '25 02:11

Dmitri T



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!