Back to Blog

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.

Back to Blog