Before starting with this tutorial, please have a look first at the Getting Started
Done? Here we go.
The HTTP Request can be modified via the "httpReq" variable that is made available to every script. Note that the instance of the httpReq variable is unique per script; it is not shared. The httpReq variable has the following properties that you can modify (except the read-only ones, of cours) and methods that you can invoke.
The script editor supports intellisense for the httpReq variable. Just type-in "httpReq." (note the dot) and the intellisense pop up will appear.
Example usages:
Change the target URL
#change the target URL.
httpReq.Uri = Uri("http://myfoo:8080/svc/" + "whatever")
Add a new set of HTTP Headers
#Clear all current HTTP Headers
httpReq.ClearHeaders()
#Add new HTTP Headers
httpReq.AddHeader("header1","someValue1")
httpReq.AddHeader("header2","someValue2")
Change the HTTP VERB to POST
#change the HTTP VERB.
httpReq.Method = Verb.POST
Change the HTTP Post Request Body
httpReq.ClearRequestBody()
#Modify the HTTP Request body. This is useful only when the
#httpReq.Method == Verb.POST or Verb.PUT
httpReq.AddRequestBody(ContentType.Json,"sdfsdf")