How to get response message HTTP Request on Beanshell Jmeter
14,549
Solution 1
It is as simple as
prev.getResponseMessage();
where prev
is a shorthand to parent SampleResult class
Demo:
See How to Use BeanShell: JMeter's Favorite Built-in Component article for more information on using Beanshell in JMeter
Solution 2
You can also use context(ctx) variable to get the previous result data:
ctx.getPreviousResult().getResponseCode();
ctx.getPreviousResult().getResponseHeaders();
ctx.getPreviousResult().getResponseData();
Author by
Hendrione
Updated on June 25, 2022Comments
-
Hendrione almost 2 years
Hi actually I want to test web service using Jmeter. but I am stuck when I want try to get response message from http request. actually I want to get the response message from beanshell post processor. How should I do to get the response code?
-
Hendrione over 7 yearsthank you, it works. but I use this method to get the response message
prev.getResponseDataAsString()
-
Hendrione over 7 yearsthank you. it works too... it shoild be alternate way to get responsedata
-
sravan ganji about 5 yearshow to get the required header from response header ? i have 2 set-cookie values ex: set-cookie: _csrf=XSASEDDDS;path=/ set-cookie: X-MY-CSRF=ABcnsfdgsg;path=/