问题
I want to:
- Get the raw text from a response body (it's XML)
- 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