Can I save/use a raw reponse body in Karate?

一曲冷凌霜 提交于 2021-02-13 17:29:23

问题


I want to:

  1. Get the raw text from a response body (it's XML)
  2. Use that as a string in a JSON request body, like And request {"externalRawResponse": "#(response)"}

But, response is already parsed into JSON. Is it possible to get the raw text version?

I tried using * text rawResponse = response but get the error no step-definition method match found for: text rawResponse = response


回答1:


Yes, read the docs: https://github.com/intuit/karate#type-conversion

* xmlstring xml = response
* request { externalRawResponse: '#(xml)' }


来源:https://stackoverflow.com/questions/52900770/can-i-save-use-a-raw-reponse-body-in-karate

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!