save image from api response to file groovy
i am new to groovy and my requirement is to save API response to image file with groovy script.
i checked with previous thread but it's not working.
Can somebody please share groovy code with required import groovy classes.
it will be very helpful,
thanks in advance.
According to the help you dont need to rely on groovy for this.
Is this for a REST step or SOAP request?
As long as this is REST, according to the help you can use the 'Dump file' atteibute within your request attributes to save a requests response including any associated file attachments.
The Dump File attribute saves REST response files, not SOAP so you could use this.
This raises the question, why bother with groovy when the native functionality does it for you? (the DumpFile property works for REST requests)
Theres just no added value. The expert groovy coders on the forum (which im not one of them) typically only extend their tests using groovy when the functionality doesnt do what is needed.
For example. You can build up an actual REST request along with the various header, uri/template and query parameters by using groovy alone, but theres no point when you have a REST test step that does it for you.
Can you clarify why you cant use the native functionality? (The Dump File property).
Could you please provide the RAW tab details (headers and payload) of your response?