英文:
Request Payload is not parsing Backward slash in Jmeter - Performance Testing
问题
我目前正在尝试传递以下请求有效载荷 {"账号号码": "123456789"} 到Jmeter中的JSR233预处理器中以打印JSON。但它在传递时忽略了反斜杠。请为此问题提供解决方案。
注意:我在反斜杠之间提供了空格,因为Stackoverflow会忽略它。
英文:
I am currently trying to pass the following request payload {\ "Account number \ ": \ "123456789 \ " to print on JSON using JSR233 Pre-processor in Jmeter. But it is ignoring the Backward slash while passing it. Kindly provide a solution for this issue.
Note: I have provided space between backward slashes because Stackoverflow keeps ignoring it.
答案1
得分: 1
如果您想在Groovy中打印包含反斜杠的String,您需要使用另一个反斜杠来转义反斜杠,如下所示:
'{"Account number \\": \\ "123456789 \\ "}'
更多关于JMeter中Groovy脚本的信息:Apache Groovy:Groovy用于什么?
英文:
If you're trying to print a String containing backslashes in Groovy you need to escape a backslash with another backslash like:
'{\\ "Account number \\ ": \\ "123456789 \\ "'
More information on Groovy scripting in JMeter: Apache Groovy: What Is Groovy Used For?
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论