gpt4 book ai didi

javascript - 从jmeter中函数_ UUID生成的uuid中删除破折号(-)

转载 作者:行者123 更新时间:2023-11-30 05:35:00 25 4
gpt4 key购买 nike

我是 jmeter 的新手,我正在调用 jmeter 中的 $(__UUID) 函数来获取 uuid。 uuid是这样生成的

14c5f969-ba57-4493-b4ba-01f1c8b6908d

如何从最终结果中删除破折号以获得 uuid

14c5f969-a574493b4ba01f1c8b6908d

我正在调用 $(__UUID) 函数,就像 jmeter 中的“HTTP 请求默认值”示例一样,PATH 文本字段设置为

/end/fa7dbe2de11f4f08b3c941ff8b5b4c08/now/${__UUID}/

最佳答案

如果我正确地回答了你的问题,并且你想从路径中删除所有破折号,可以通过 Beanshell Pre Processor 完成。 .

将它添加为需要替换的 HTTP 请求的子项,并放置类似

String path = sampler.getPath();
sampler.setPath(path.replaceAll("-",""));

到“脚本”区域。

此代码将替换 HTTP 请求路径中出现的所有破折号。

参见 How to use BeanShell: JMeter's favorite built-in component有关 Apache JMeter 中的 Beanshell 脚本编写和 Beanshell 说明书的更多信息的指南。

关于javascript - 从jmeter中函数_ UUID生成的uuid中删除破折号(-),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24426337/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com