Forum Discussion
cortez
13 years agoOccasional Contributor
OK, I eventually solved it by computing the response from the script, rather than returning the contents of a file, like this:
The 202 response code is returned successfully using that method.
if ( mockRequest.method == "POST" )
{
def mockResponse = mockRequest.getHttpResponse()
mockResponse.setHeader("Location","/foo/bar/123")
mockResponse.setStatus(202, "Accepted")
mockResponse.getWriter().print("{\n \"link\":\"/foo/bar/123\"\n}")
return new com.eviware.soapui.impl.wsdl.mock.WsdlMockResult(mockRequest)
}
The 202 response code is returned successfully using that method.