I was working with on a Jmeter script.
At the 1st Response I have extract a lengthy code which I have to pass to the next request.
Unfortunately, the 1st request contains "\x2D" characters , which need to be replaced with "-".
Is there any way to do this.
I tried with below code on a BeanShell PostProcessor
, but its giving me an error.
def originalValue = vars.get("BE_stateToken");
def newValue = originalValue.replace("\x2D", "-");
vars.put("myVar", newValue);
log.info("Variable myVar value: " + vars.get("myVar"));
Below are the errors I'm getting.
2023-08-29 14:17:48,365 ERROR o.a.j.u.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of:
def originalValue = vars.get("BE_stateToken"); def newValue = originalValue.re . . . '' : Typed variable declaration : Class: def not found in namespace 2023-08-29 14:17:48,365 WARN o.a.j.e.BeanShellPostProcessor: Problem in BeanShell script: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of:
def originalValue = vars.get("BE_stateToken"); def newValue = originalValue.re . . . '' : Typed variable declaration : Class: def not found in namespace 2