我想:
- 从响应正文(XML(获取原始文本
- 将其用作 JSON 请求正文中的字符串,如
And request {"externalRawResponse": "#(response)"}
但是,response
已经解析为 JSON。是否可以获得原始文本版本?
我尝试使用* text rawResponse = response
但得到错误no step-definition method match found for: text rawResponse = response
是的,请阅读文档:https://github.com/intuit/karate#type-conversion
* xmlstring xml = response
* request { externalRawResponse: '#(xml)' }