Pranav
Pranav

Reputation: 2172

Jmeter - use csv for setting http header

I want to set header for each request.

header is - "token:value"

For every request this header value will be different and I have a csv file having all tokens listed there. Now, like we use csv for POST data values, I want to use this csv file to set header for each request.

CSV file - "token1,token2,token3"

How to do this in jmeter ?

Upvotes: 2

Views: 4429

Answers (3)

sbos61
sbos61

Reputation: 564

the idea is pretty good, if the referer field is widely used.

I'm not sure that you can use CSV data sets, because it reads ONE line for each user/ thread.

In a situation similar to yours, I had to use a __CSVread function, that allows to manually control if and when to read the next line.

Refer to: "CSVRead">http://jmeter.apache.org/usermanual/functions.html#_CSVRead"

Upvotes: 1

Jay
Jay

Reputation: 1409

To achieve your goal, you should do following for each request:

  1. Add HTTP Header Manager:

enter image description here

2 . Add CSV Data Set Config configured like this:

CSV Data Set Config

Upvotes: 9

olyv
olyv

Reputation: 3817

If request the same but header changes, then you obviously need CSV Data Set Config element. Example of usage you can find in %JMETER_HOME%/bin/examples. If requests are different then I'm not sure it makes sens to use CSV file.

Upvotes: 0

Related Questions