API not working in ReadyAPI though it works in swagger or Postman
- 7 years ago
well, finally I executed the following groovy script :
import com.eviware.soapui.support.types.StringToStringMap
testRunner.testCase.testSuite.project.testSuites.each
{
suite ->
suite.getValue().testCases.each
{
q1->
q1.getValue().testSteps.each
{
it->
if (it.getValue().config.type.equals("restrequest"))
{
//Get the headers of the current teststep
def headers = it.getValue().getHttpRequest().getRequestHeaders()
//log.info "headers = " + headers
def list = []
//Append the new header to the existing list
list.add("application/json")
log.info "list = " + list
headers["Accept"] = list;
//Set the updated header list
it.getValue().getHttpRequest().setRequestHeaders(headers)
}
}
}
}