请求负载在Jmeter中未解析反斜杠 – 性能测试

huangapple go评论73阅读模式
英文:

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 \\ "'

请求负载在Jmeter中未解析反斜杠 – 性能测试

More information on Groovy scripting in JMeter: Apache Groovy: What Is Groovy Used For?

huangapple
  • 本文由 发表于 2023年7月14日 01:57:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/76682095.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定