2013-01-30

What is HTTP Header Manager? Why we use it

In this following article we are going to see what is HTTP Header Manager in JMeter and why we use it.

By naming, we can understand it is one king of element that controls the header. And, it will be present in side a config element(as it holds all type of configurable elements)

So, When ever we add a HTTP Header Manager(Thread group->(right click)add->Config Element)->HTTP Header Manager). We can see a section "Headers Stored in the Header Manager". This section contains all header. We can either add or load(previously saved) a header list.
So, When we add a header we have provide type of http header as name and the string of the header as value.
Ex- If we want to add a opera User-Agent in header, we will add a blank row, we will write "User-Agent" in the name section and value "Opera/12.80 (Windows NT 5.1; U; en) Presto/2.10.289 Version/12.02"

Note: When we add headers in the manager, those headers are append to the request. For a whole thread group, one header manager should be present(multiple supported). If one header added to multiple manager , latest one(or specific one) will be use.

Some useful headers are
-Accept  
-Accept-Charset  
-Accept-Encoding  
-Accept-Language  
-Accept-Datetime     
-Cache-Control  
-Connection  
-Cookie    [preciously set cookie, (different from cookie manager)]
-Content-Length  
-Content-Type  
-Date  
-Expect  
-Host        
-Pragma  
-Proxy-Authorization  
-Range  
-Referer     
-Upgrade  
-User-Agent  
-Via  
-Warning



We can see the full list in this here.

Why we use HTTP Header Manager? When we need to send http request with specific header( that may define the http response because of that header). For example,
-when we need specify user agent/browsers
-When we need to specify language
-When we need to specify Date/Time
-When we need to specify Date
-When we need to specify Content Length/type
-When we need to specify conditions of response to server
-When we need to specify proxy

... Thanks..:)