Service Test 11 – Can you add HTTP Headers?
I've received a few email's asking if it's possible to add HTTP headers in Service Test 11.
A few examples have been users of LoadRunner 9.5/Service Test that were using the web_add_header function and wanted to do the same in ST 11. Something like this:
Well the good news is -- Yes -- this is possible!
How to add HTTP headers in Service Test 11
To specify headers in a HTTP request in ST11 you can do the following using custom code:
- Click on your web service operation in the ST canvas area
- Under the operation's Property Sheet click on the Events icon
- Dbl click on the 'OnSendRequest' event
- Under the TestUsercode for the _OnOnSendRequest enter the following code
- this.StServiceCallActivity4.HttpRequestHeaders.Add("Your_key", "Your_value");
Cool – that's how you add HTTP headers to Service Test 11.