I’m posting HTTP request and JSR223 pre-processer to pass values like shown below,
Steps:
- HTTP post request reading values from JSR223 pre-proccesser
- Want to send null value for variable
JSR223 pre-processer :
vars.put("aptstatus","A")
vars.put("isccode",null)
I have used above way to pass value but in post request it is shown as
"status": "${aptstatus}",
"serviceCode": "${isccode}",
My requirement is to send null value in http post request.
Please help here how to set null value in variable.
Note: serviceCode is VARCHAR type
>Solution :
-
In the JSR223 PreProcessor:
vars.put("isccode", 'null') -
In the HTTP Request sampler:
"status": "${aptstatus}", "serviceCode": ${isccode}
You will get:
"status": "A", "serviceCode": null
Demo:
More information on Groovy scripting in JMeter: Apache Groovy: What Is Groovy Used For?
