VuGen: Capture ALL HTTP Responses

Let’s say you want to capture the http response of a page, but it redirects you (code 302). The normal way you might capture the HTTP status code is capturing it in a variable:

HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);

This would be put after the page request in the script. However, this will only capture the LAST status code received. If there is a redirection in between, it will not be captured. So how do you get the first one? Capture the response header using a correlation. Use the web_reg_save_param function with the following arguments:

Use the “ORD=ALL” argument to capture all occurrences. Use the “Search=Headers” argument to search the response header only.

Here is an example:

web_reg_save_param("response","LB=HTTP/1.1 ", "RB= ", "Search=Headers" ,"ORD=ALL", LAST);

Then just spit out “response” to the output log as a message.

What's Next?

Did you enjoy this article? Help spread the word by sharing:

Join the Northway Navigator Club today and get access to restricted content including our best tips and tricks. Membership is free! You will also receive free email updates by registering.

Engage in the conversation and leave a comment:

Scott Moore

About Scott Moore (153 articles)

With over 20 years of IT experience with various platforms and technologies, Scott has tested some of the largest applications and infrastructures in the world. He is a Certified Instructor and Certified Product Consultant in HP’s LoadRunner and Performance Center products. He currently holds HP certifications for ASE, ASC, and CI. A thought leader in the APM space, he speaks regularly at IT conferences and events

  • Vini

    Thats not the best way..thers a function available for the same

  • Scott Moore

    Please note this posting was from March 18, 2009 – migrated from the web site. web_reg_save_param is actually deprecated in version 11. See the function reference guide for web_reg_save_param_ex.