Highlighted
Absent Member.
Absent Member.
1529 views

How to add http headers to a GET-request in TruClient?

Jump to solution

When a GET request is made to a server, the browser sends HEADER data in that request to the server, like the following example

GET /tutorials/other/top-20-mysql-best-practices/ HTTP/1.1
Host: net.tutsplus.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: PHPSESSID=r2t5uvjq435r4q7ib3vtdjq120
Pragma: no-cache
Cache-Control: no-cache

(taken from headers for dummies). Is there a way to set/change those headers when opening a web-page within a TruClient script?

In other words: I want to use a TruClient-step to set a modified header to some adress. Is that possible? If so, how? If not, why not?

 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: How to add http headers to a GET-request in TruClient?

Jump to solution

Hi,

TruClient allows adding custom header but not modifying existing ones.

You can use Utils.addAutoHeader function in "Evaluate JavaScript" step priori to the step that triggers the request.

Read more about this function and others in http://tchelp.saas.hp.com/en/Latest/Content/TruClient/_tc_r_functions.htm

Regards,

Shlomi

View solution in original post

1 Reply
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: How to add http headers to a GET-request in TruClient?

Jump to solution

Hi,

TruClient allows adding custom header but not modifying existing ones.

You can use Utils.addAutoHeader function in "Evaluate JavaScript" step priori to the step that triggers the request.

Read more about this function and others in http://tchelp.saas.hp.com/en/Latest/Content/TruClient/_tc_r_functions.htm

Regards,

Shlomi

View solution in original post

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.