Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read a value from response header in jmeter?

Tags:

jmeter

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 ?

like image 610
Sourabh Avatar asked Apr 11 '16 11:04

Sourabh


1 Answers

  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$

      Regular Expression Configuration

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


  1. References:

    • Regular Expressions
    • Using RegEx (Regular Expression Extractor) With JMeter
like image 192
Dmitri T Avatar answered Oct 05 '22 05:10

Dmitri T