Forum Discussion
avidCoder
8 years agoSuper Contributor
I think you should try below code:-
import com.eviware.soapui.support.types.StringToStringMap
def headers = new StringToStringMap()
headers.put("Authorization", "Basic abcxyz123456....")
headers.put("Cache-Control", "no-cache")
headers.put("Pragma", " no-cache")
headers.put("Expires", " Sat, 01 Jan 2000 00:00:00 GMT")
headers.put("Content-Type", "application/json")
boolean str = testRunner.testCase.testSteps["Your Request"].testRequest.requestHeaders["Accept"]
log.info str
if(str) {
log.info "123"
headers.remove("Accept")
headers.put("Accept", "application/octet-stream")
} else {
headers.put("Accept", "application/json")
}It will go to if loop now.
TDYSmartBear
8 years agoOccasional Contributor
Thank you for the help! By using Swagger and that solved the problem. :)