I have 2 files as:
- The first is text file contains multiple lines:
And def txtContent = read(path-to-text-file)
txtContent is multiple-line string, as example:
1a
2b
3c
- The second is xml file contain request template:
<customizedTag>
<time>#(send_time)<time>
<bodyData>#(txtContent)</bodyData>
</customizedTag>
When run the following steps to build body request then get wrong format, as below:
And def send_time = LocalDateTime.now() + ''
And def txtContent = read(path-to-text-file)
And def buildBodyRequest = read(path-to-xml-template-file)
* print buildBodyRequest
The output of buildBodyRequest same as:
<customizedTag>
<time>2022-05-01T12:56:45.324104300<time>
<bodyData>1a
2b
3c</bodyData>
</customizedTag>
The special string
appeared in the body request and its make request is wrong format.
So please help me if you know that how to remove/replace the special string
in the body request in karate? Thanks!
My expected for that:
<customizedTag>
<time>2022-05-01T12:56:45.324104300<time>
<bodyData>1a
2b
3c</bodyData>
</customizedTag>