When I run the REST request, my response is 开发者_如何学Python
HTTP/1.1 204 No Content Date: Fri, 01 Oct 2010 17:18:11 GMT X-Response-ID: 10016
How to verify this? Because it is header i guess. How to add assertion for this? When i decloare
You can use the method messageExchange.responseHeaders
[field] to access the HTTP header fields like #status*
, Content-Type
, Accept
etc.
def http_status = messageExchange.responseHeaders["#status#"][0]
assert http_status.contains("204")
import com.eviware.soapui.support.XmlHolder
def holder = new XmlHolder( messageExchange.responseContentAsXml )
def node = holder.getDomNode( "//data[1]/@contentType" )
assert node != null
assert((com.eviware.soapui.support.types.StringList)messageExchange.responseHeaders["#status#"]).containsValue("HTTP/1.1 204 No Content")
精彩评论