Forum Discussion
Hi Nastya, Thank you for the effort and reply.
I didn't attach file to attachment tab due to default binary encoding. Request is designed to send base64 encoded file. Is there any way to change the default file encoding inside ReadyAPI?
Now for the empty line between those multipart headers -
I am creating json part on the fly via groovy script in order to update json nodes with different data such as currentdate, new relationship no, contact etc... As part of this process I am hardcoding second header line as I am not sure how to include it automatically with form-data.
//## build json body and write to a file for reference ##//
def REQUEST = new JsonBuilder(metaDataVal).toString()
REQUEST = "Content-Type: application/json; charset=utf-8\r\n\r\n" + "$REQUEST"
testRunner.testCase.setPropertyValue("docMetaData", REQUEST)
For the file part - I am encoding the file and hard coding other headers too (attached a file to show the file content).
Multipart/form-data puts only Content-Disposition: header.
//## READ canned request from a file to modify ##//
def testFile = new File(RequestPath + "testFile.txt").text //## base64 encoded format is stored in this file ##//
testRunner.testCase.setPropertyValue("testFile", "$testFile")
Hi,
Ok, thank you for the information. I can recommend that you check the following articles:
- How to send binary data in the request payload?
- Troubleshooting issues with adding attachments to REST requests