使用JMeter从响应标题中提取位置 [英] Extract Location from Response Header with JMeter
本文介绍了使用JMeter从响应标题中提取位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个字符串:
Location →/cochise/workflow/5c46e69364ddf300013412b5
如何使用jmeter提取最终的十六进制代码?
How do I extract the final hexadecimal code using jmeter?
推荐答案
使用以下配置将Regular Expression Extractor
后处理器添加为您请求的子代:
Add a Regular Expression Extractor
post processor as a child of your request with below configurations:
- 适用于:
Main sample and sub-samples
- 要检查的字段:
Response Headers
- 参考名称:
myVar
- 正则表达式:
Location: .+\/(.*?)\n
- 模板:
$1$
- 比赛编号:
1
- 默认值:
NOT_FOUND
- Apply to:
Main sample and sub-samples
- Field to check:
Response Headers
- Reference Name:
myVar
- Regular Expression:
Location: .+\/(.*?)\n
- Template:
$1$
- Match No:
1
- Default Value:
NOT_FOUND
现在,您可以使用包含十六进制值的jmeter变量${myVar}
.您可以在线程组级别添加视图结果树和调试采样器,以确保提取正确的值.
Now you can use jmeter variable ${myVar}
which contains hexadecimal value. You can add view results tree and debug sampler at thread group level to make sure you are extracting the right value.
参考
- 正则表达式(来自Jmeter用户手册).
使用带有jmeter的正则表达式
- Regular expressions from Jmeter user manual.
- Using regex with jmeter
这篇关于使用JMeter从响应标题中提取位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文