如何从jmeter的响应头中读取值? [英] How to read a value from response header in jmeter?

查看:23
本文介绍了如何从jmeter的响应头中读取值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下标题作为回应:HTTP/1.1 200 正常日期:2016 年 4 月 11 日星期一 10:36:10 GMT内容处置:附件;文件名=result.xml;x-xss-保护:1;模式=访问保持活动:超时=5,最大值=100我想从标题中读取文件名,如何使用正则表达式来捕获这个值?

解决方案

  1. 添加

  2. 在需要的地方将提取的值引用为 ${filename}

<小时>

  1. 参考文献:

I am getting following header in response : HTTP/1.1 200 OK Date: Mon, 11 Apr 2016 10:36:10 GMT content-disposition: attachment; filename=result.xml; x-xss-protection: 1; mode=access Keep-Alive: timeout=5, max=100 I want to read filename from header, how can I use regular expression to capture this value ?

解决方案

  1. Add Regular Expression Extractor as a child of the HTTP Request which returns above headers
  2. Configure it as follows:

    • Apply to: Main sample only or Main sample and sub-samples depending on whether header comes in main response or nested responses
    • Field to check: Response Headers. This bit is super important
    • Reference Name: anything meaningful, i.e. filename
    • Regular Expression: filename=(.+?);
    • Template: $1$

  3. Refer extracted value as ${filename} where required


  1. References:

这篇关于如何从jmeter的响应头中读取值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆