cancel
Showing results for 
Search instead for 
Did you mean: 

Generated code .net 2.0 - How to add Cookie to the header ???

ezuser
Occasional Visitor

Generated code .net 2.0 - How to add Cookie to the header ???

I need urgent help:

I generated some C# code from SOAPUI useing "Generate Code" - ".net 2.0" tool.
It works nicely when I need just to pass fields to the request.
But I can not find correct way to pass to it cookies that is used in the header.

What object can I use for it?

In previous version of this task that do not use generated code I have used something like this:

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(destinationUrl);

     request.Headers.Add("Cookie", "LoginCert=" + token);

1 REPLY 1
aaronpliu
Frequent Contributor

Re: Generated code .net 2.0 - How to add Cookie to the header ???

Hi ezuser,

 

If you would like to add parameter (like cookie) to Header, then you may use below scripts:

 

import com.eviware.soapui.support.types.StringToStringMap
def teststep = testRunner.testCase.testSteps["YourStepName"]
teststep.testRequest.setRequestHeaders(new StringToStringMap(["cookie": "YourCookie"]))
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors