Forum Discussion

bkbn16's avatar
bkbn16
Contributor
8 years ago

Return the response attachment in a groovy script

I have attached a image/jpeg file in the POST request in a REST project. The image is cached in the Attachments table. The uploaded image is a request with appropriate Header fields. I need a groovy script that would send the same uploaded image request as a response image. How do I do it ?

 

I have followed the script in the thread https://community.smartbear.com/t5/SoapUI-Open-Source/Saving-attachments-automatically/m-p/880#U880 but unfortunately did not get the right output.

 

The script should be like ...

1. def ImageReq = // point to the attached cached image/jpeg request under REST project ? 

2. copy ImageReq and paste it to a new file ImageResp
3. attach the ImageResp in response section of REST project

4. OutputFile = // points to the attachment in the Response section and return it

 

How do I do this ?